XWorkstation.st
author Stefan Vogel <sv@exept.de>
Mon, 22 Oct 2012 19:20:54 +0200
changeset 5936 32467c3ce97d
parent 5934 456535dcca66
child 5938 f5d6189257d4
permissions -rw-r--r--
Fixed copy/paste problem changed: #getProperty:from:delete:
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
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
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
"
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    12
"{ 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
    13
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    14
DeviceWorkstation subclass:#XWorkstation
5510
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    15
	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    16
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
    17
		hasImageExtension hasInputExtension hasXineramaExtension
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
    18
		ignoreBackingStore blackpixel whitepixel atoms protocolsAtom
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
    19
		deleteWindowAtom saveYourselfAtom quitAppAtom primaryAtom
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
    20
		clipboardAtom stringAtom wmStateAtom motifWMHintsAtom
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
    21
		listOfXFonts buttonsPressed eventRootX eventRootY displayName
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
    22
		eventTrace dispatchingExpose rgbVisual virtualRootId rootId
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
    23
		altModifierMask metaModifierMask lastEventTime rawMonitorBounds
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
    24
		monitorBounds lastButtonPressTime deviceIOTimeoutErrorSignal
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
    25
		activateOnClick rawKeySymTranslation selectionOwner selectionTime
5510
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    26
		selectionFetchers selectionHandlers preWaitAction xlibTimeout
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    27
		xlibTimeoutForWindowCreation hasConnectionBroken uniqueDeviceID
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
    28
		stxDeviceAtom uuidAtom primaryBuffer'
5510
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    29
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    30
		DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation'
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    31
	poolDictionaries:''
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    32
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    33
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    34
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    35
Object subclass:#SelectionFetcher
5510
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    36
	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    37
		buffer done incremental'
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    38
	classVariableNames:''
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    39
	poolDictionaries:''
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
    40
	privateIn:XWorkstation
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    41
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    42
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    43
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    44
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    45
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    46
#define SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    47
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    48
#ifdef LINUX
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    49
# define SHM
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    50
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    51
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    52
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    53
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    54
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    55
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    56
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    57
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    58
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    59
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    60
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    61
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    62
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    63
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    64
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    65
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    66
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    67
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    68
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    69
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    70
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    71
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    72
 * 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
    73
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    74
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    75
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    76
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    77
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    78
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    79
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    80
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
    81
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    82
#include <stdio.h>
5528
42447013fbc6 freebsd
Michael Beyl <mb@exept.de>
parents: 5525
diff changeset
    83
#ifndef FREEBSD
42447013fbc6 freebsd
Michael Beyl <mb@exept.de>
parents: 5525
diff changeset
    84
# include <malloc.h>
42447013fbc6 freebsd
Michael Beyl <mb@exept.de>
parents: 5525
diff changeset
    85
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    86
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    87
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    88
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    89
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    90
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    91
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    92
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    93
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    94
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    95
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    96
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    97
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    98
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
    99
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   100
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   101
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   102
 * 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
   103
 * 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
   104
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   105
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   106
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   107
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   108
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
   109
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
   110
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   111
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
   112
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   113
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   114
48194c26a46c Initial revision
claus
parents:
diff changeset
   115
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   116
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   117
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   118
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   119
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   120
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   121
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   122
48194c26a46c Initial revision
claus
parents:
diff changeset
   123
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   124
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   125
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   126
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   127
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   128
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   129
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   130
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   131
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   132
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   133
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   134
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   135
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   136
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   137
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   138
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   139
/*
186
claus
parents: 180
diff changeset
   140
 * PEX extension - if available
claus
parents: 180
diff changeset
   141
 */
claus
parents: 180
diff changeset
   142
#ifdef PEX5
claus
parents: 180
diff changeset
   143
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   144
#endif
claus
parents: 180
diff changeset
   145
claus
parents: 180
diff changeset
   146
/*
claus
parents: 180
diff changeset
   147
 * XImage extension - if available
claus
parents: 180
diff changeset
   148
 */
claus
parents: 180
diff changeset
   149
#ifdef XIE
claus
parents: 180
diff changeset
   150
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   151
#endif
claus
parents: 180
diff changeset
   152
5865
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   153
#ifdef XINERAMA
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   154
# include <X11/extensions/Xinerama.h>
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   155
#endif
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   156
186
claus
parents: 180
diff changeset
   157
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   158
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   159
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   161
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   162
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   163
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   164
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   165
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   166
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   167
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   168
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   169
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   170
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   171
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   172
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   173
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   174
 * if nformats cannot be found in the Display structure ...
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   175
 */
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   176
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   177
#endif
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   178
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   179
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   180
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   181
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   182
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   183
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   184
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   185
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   186
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   187
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   188
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   189
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   190
 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   191
#define __DisplayVal(o)      (Display *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   192
#define __DrawableVal(o)     (Drawable)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   193
#define __WindowVal(o)       (Window)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   194
#define __PixmapVal(o)       (Pixmap)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   195
#define __GCVal(o)           (GC)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   196
#define __CursorVal(o)       (Cursor)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   197
#define __FontVal(o)         (XFontStruct *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   198
#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
   199
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   200
#define __MKATOMOBJ(a)       __MKSMALLINT(a)   /* add STORE macro if ever changed */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   201
#define __AtomVal(o)         __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   202
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   203
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   204
#define myDpy                __DisplayVal(__INST(displayId))
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   205
#define ISCONNECTED          ((__INST(displayId) != nil) && (__INST(hasConnectionBroken) != nil))
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   206
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   207
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   208
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   209
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   210
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   211
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   212
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   213
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   214
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   215
/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   216
 * these two macros should be placed around X-lib calls,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   217
 * which may block due to a broken connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   218
 * They setup/remove a VM-timeout which raises an exception
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   219
 * after xlibTimeout seconds.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   220
 * This exception will shutDown the connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   221
 * Q: is this a good idea for the local display ?
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   222
 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   223
#define __ENTER_XLIB(whichTimeout)   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   224
    { \
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   225
        __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   226
        __blockingPrimitiveTimeoutArg__ = self; \
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   227
        __blockingPrimitiveTimeout__ = __intVal(__INST(whichTimeout)) * 1000; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   228
    } {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   229
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   230
#define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   231
    { \
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   232
        __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)0; \
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   233
        __blockingPrimitiveTimeoutArg__ = nil; \
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   234
        __blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   235
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   236
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   237
#define ENTER_XLIB()   __ENTER_XLIB(xlibTimeout)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   238
#define ENTER_XLIB2()  __ENTER_XLIB(xlibTimeoutForWindowCreation)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   239
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   240
#ifdef SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   241
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   242
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   243
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   244
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   245
# ifndef MWM_HINTS_FUNCTIONS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   246
#  define MWM_HINTS_FUNCTIONS       (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   247
#  define MWM_HINTS_DECORATIONS     (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   248
#  define MWM_HINTS_INPUT_MODE      (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   249
#  define MWM_HINTS_STATUS          (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   250
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   251
#  define MWM_FUNC_ALL              (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   252
#  define MWM_FUNC_RESIZE           (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   253
#  define MWM_FUNC_MOVE             (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   254
#  define MWM_FUNC_MINIMIZE         (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   255
#  define MWM_FUNC_MAXIMIZE         (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   256
#  define MWM_FUNC_CLOSE            (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   257
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   258
#  define MWM_INPUT_MODELESS                      0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   259
#  define MWM_INPUT_PRIMARY_APPLICATION_MODAL     1
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   260
#  define MWM_INPUT_SYSTEM_MODAL                  2
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   261
#  define MWM_INPUT_FULL_APPLICATION_MODAL        3
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   262
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   263
#  define MWM_DECOR_NONE            0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   264
#  define MWM_DECOR_ALL             (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   265
#  define MWM_DECOR_BORDER          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   266
#  define MWM_DECOR_RESIZEH         (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   267
#  define MWM_DECOR_TITLE           (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   268
#  define MWM_DECOR_MENU            (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   269
#  define MWM_DECOR_MINIMIZE        (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   270
#  define MWM_DECOR_MAXIMIZE        (1L << 6)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   271
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   272
#endif /* SUPPORT_MOTIF_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   273
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   274
/*
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   275
 * openlook hints are not supported yet
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   276
 * - noone needs them anymore ;-(
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   277
 */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   278
#ifdef SUPPORT_OPENLOOCK_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   279
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   280
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   281
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   282
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   283
# ifndef OL_DECOR_CLOSE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   284
#  define OL_DECOR_CLOSE            (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   285
#  define OL_DECOR_RESIZEH          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   286
#  define OL_DECOR_HEADER           (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   287
#  define OL_DECOR_ICON_NAME        (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   288
#  define OL_DECOR_ALL              (OL_DECOR_CLOSE | OL_DECOR_RESIZEH | OL_DECOR_HEADER | OL_DECOR_ICON_NAME)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   289
#  define OL_ANY_HINTS              (1L << 7)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   290
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   291
#endif /* SUPPORT_OPENLOOCK_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   292
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
   293
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   294
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   295
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   296
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   297
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   298
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   299
/*
146
claus
parents: 145
diff changeset
   300
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   301
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   302
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   303
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   304
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   305
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   306
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   307
static int __debug__ = 0;
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   308
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   309
#define DPRINTF(x)      if (__debug__) { console_printf x; }
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   310
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   311
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   312
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   313
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   314
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   315
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   316
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   317
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   318
 * 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
   319
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   320
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   321
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   322
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   323
# ifdef __GNUC__
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   324
VOLATILE
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   325
# endif
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   326
static
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   327
dummyToForceLoading() {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   328
        XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   329
        XCloseDisplay(0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   330
        XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   331
        XSetWindowColormap(0, 0, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   332
        XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   333
# ifdef SHM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   334
        XShmAttach(0, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   335
        XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   336
        XShmDetach(0, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   337
        XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   338
        shmctl(0,0,0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   339
        fgetc(0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   340
# endif
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   341
}
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   342
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   343
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   344
#undef __myInstPtr
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   345
#define __myInstPtr(obj) ((struct __XWorkstation_struct *)(obj))
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   346
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   347
/*
144
claus
parents: 143
diff changeset
   348
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   349
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   350
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   351
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   352
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   353
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   354
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   355
int
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
   356
__XErrorHandler__(dpy, event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   357
    Display *dpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
   358
    XErrorEvent *event;
48194c26a46c Initial revision
claus
parents:
diff changeset
   359
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   360
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   361
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   362
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   363
    if (lastErrorMsg[0] == '\0') {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   364
        sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   365
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   366
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   367
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   368
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   369
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   370
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   371
         * this is a BadWindow error for X_DestroyWindow.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   372
         * ignore it here, since it results from the GC freeing windows
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   373
         * in non bottom-up window order.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   374
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   375
        return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   376
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   377
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   378
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   379
        console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   380
                        event->request_code, event->request_code,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   381
                        event->minor_code, event->minor_code, event->resourceid);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   382
        console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   383
                        event->error_code, lastErrorMsg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   384
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   385
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   386
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   387
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   388
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   389
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   390
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   391
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   392
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   393
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   394
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   395
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   396
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   397
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   398
int
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   399
__XIOErrorHandler__(dpy)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   400
    Display *dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   401
{
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   402
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   403
        console_fprintf(stderr, "XWorkstation [error]: I/O error\n");
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   404
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   405
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   406
                                                  __MKEXTERNALADDRESS(dpy));
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   407
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   408
#if 0
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   409
    /*
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   410
     * don't do this.
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   411
     * This error is called asynchronously, and the wrong process may be terminated
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   412
     */
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   413
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   414
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   415
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   416
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   417
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   418
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   419
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   420
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   421
    /* never reached */
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   422
#endif
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   423
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   424
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   425
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   426
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   427
/*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   428
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   429
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   430
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   431
 * timeoutHandler has been set.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   432
 */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   433
void
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   434
__XTimeoutErrorHandler(displayDeviceInst)
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   435
    OBJ displayDeviceInst;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   436
{
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   437
    if ((displayDeviceInst == @global(MainDisplay))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   438
        || (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   439
        console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   440
        return;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   441
    }
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   442
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   443
        console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%x\n", displayDeviceInst);
4636
6c715971d212 Fix display timeout error handling
Stefan Vogel <sv@exept.de>
parents: 4635
diff changeset
   444
    }
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   445
    __OINST(displayDeviceInst, hasConnectionBroken) = true;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   446
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   447
    __PROTECT__(displayDeviceInst);
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   448
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   449
    __UNPROTECT__(displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   450
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   451
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   452
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   453
     */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   454
    if (__OINST(displayDeviceInst, displayId) != nil) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   455
        __internalError("unhandled X11 display timeout error");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   456
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   457
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   458
         * the current process failed to do an X11 request.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   459
         * Terminate it!
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   460
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   461
        __terminateProcess(0);      /* soft terminate */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   462
        __terminateProcess(1);      /* hard terminate */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   463
    }
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   464
}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   465
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   466
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   467
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   468
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   469
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   470
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   471
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   472
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   473
COPYRIGHT (c) 1989 by Claus Gittinger
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   474
              All Rights Reserved
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   475
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   476
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   477
 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
   478
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   479
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   480
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   481
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   482
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   483
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   484
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   485
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   486
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   487
    this class provides the interface to X11. It redefines all required methods
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   488
    from DeviceWorkstation.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   489
    Notice, that in Smalltalk/X you are not technically limited to one display;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   490
    in theory (and in our practice), you can create Views on many displays
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   491
    simultanously. However, the default setup is for one display only.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   492
    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
   493
    process for the other display(s) and create the other views with a slightly
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   494
    different protocol (ApplicationModel openOnDevice:) or by temporarily answering
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   495
    the other device to the currentScreen query.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   496
    Therefore, 'normal' applications do not have to care for all of this, as the currentScreen
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   497
    query is answered by the launcher when opening its applications.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   498
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   499
    Timeouts:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   500
        sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   501
        default, this would lead to a locked ST/X system.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   502
        Therefore, this class defines a timeOut, whenever doing an Xlib call.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   503
        The default for this timeout is 30seconds.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   504
        This may be a problem with windowmanagers which show a rubber-band rectangle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   505
        when creating windows.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   506
        If the user does not specify the rectangle within 30 seconds, the device assumes
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   507
        a timeout and closes the connection.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   508
        As a (kludgy) workaround, a second timeout value is used for window-creation.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   509
        This secondary timeout value defaults to 60*5 seconds (5 minutes).
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   510
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   511
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   512
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   513
    [author:]
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   514
        Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   515
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   516
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   517
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   518
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   519
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   520
initialize
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   521
    ConservativeSync := OperatingSystem platformName == #win32.
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   522
3267
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   523
    "/ some XServers crash, when given too long strings in XDrawString/XDrawInageString.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   524
    "/ the following is an adjustable soft-limit.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   525
    MaxStringLength := 4096.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   526
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   527
    "/ shutdown the X-connection, when no response is received after that many seconds.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   528
    DefaultXLibTimeout := 30.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   529
    DefaultXLibTimeoutForWindowCreation := 5*60.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   530
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   531
    RawKeySymTranslation isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   532
        "/ the following table maps X-keyevents to ST/X
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   533
        "/ device independend events.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   534
        "/ It is NOT meant as a keyboardMap replacement.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   535
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   536
        RawKeySymTranslation := Dictionary new:6.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   537
        RawKeySymTranslation
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   538
            at:#'Delete_line' put:#DeleteLine;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   539
            at:#'Delete_word' put:#DeleteWord;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   540
            at:#Down put:#CursorDown;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   541
            at:#Up put:#CursorUp;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   542
            at:#Left put:#CursorLeft;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   543
            at:#Right put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   544
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   545
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   546
    "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
   547
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   548
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   549
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   550
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   551
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   552
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   553
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   554
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   555
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   556
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   557
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   558
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   559
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   560
#ifdef COUNT_RESOURCES
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   561
    console_fprintf(stderr, "colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n",
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   562
            __cnt_color, __cnt_bitmap,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   563
            __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
   564
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   565
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   566
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   567
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   568
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   569
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   570
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   571
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   572
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   573
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   574
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   575
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   576
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   577
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   578
getConnectionTimeOut
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   579
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   580
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   581
    ^ DefaultXLibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   582
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   583
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   584
getConnectionTimeOutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   585
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   586
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   587
    ^ DefaultXLibTimeoutForWindowCreation
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   588
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   589
135
claus
parents: 133
diff changeset
   590
lastErrorString
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   591
    "return the last X-error string -
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   592
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   593
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   594
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   595
    |string s match line|
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   596
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   597
    string := self errorStringOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   598
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   599
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   600
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   601
    "
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   602
    match := 'XRequest.' , self requestCodeOfLastError printString.
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
   603
    s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil.
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   604
    s notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   605
        line := s peekForLineStartingWith:match.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   606
        s close.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   607
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   608
    line isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   609
        string := string, ' in ', match
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   610
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   611
        string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   612
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   613
    ^ string
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   614
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   615
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   616
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   617
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   618
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   619
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   620
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   621
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   622
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   623
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   624
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   625
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   626
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   627
%}
135
claus
parents: 133
diff changeset
   628
!
claus
parents: 133
diff changeset
   629
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   630
resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   631
%{  /* NOCONTEXT */
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   632
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   633
      if (lastResource != 0) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   634
         RETURN ( __MKEXTERNALADDRESS(lastResource) );
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   635
      }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   636
%}.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   637
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   638
     ^ nil
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   639
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   640
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   641
     "
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   642
         Screen resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   643
     "
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   644
!
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   645
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   646
setConnectionTimeOut:seconds
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   647
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   648
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   649
    DefaultXLibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   650
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   651
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   652
setConnectionTimeOutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   653
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   654
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   655
    DefaultXLibTimeoutForWindowCreation := seconds
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   656
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   657
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   658
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   659
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   660
platformName
133
claus
parents: 132
diff changeset
   661
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   662
     Return a string describing the display systems platform.
5036
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   663
     XWorkstation always returns #X11."
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   664
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   665
    ^ #X11  "I don't know what ST-80 returns for X ..."
715
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   666
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   667
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   668
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   669
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   670
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   671
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   672
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   673
    "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
   674
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   675
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   676
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   677
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   678
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   679
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   680
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   681
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   682
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   683
     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
   684
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   685
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   686
     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
   687
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   688
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   689
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   690
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   691
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   692
    prev := activateOnClick ? false.
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   693
    aBoolean notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   694
        activateOnClick := aBoolean.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   695
    ].
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   696
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   697
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   698
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   699
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   700
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   701
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   702
!
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   703
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   704
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   705
    "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
   706
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   707
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   708
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   709
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   710
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   711
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   712
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   713
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   714
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   715
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   716
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   717
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   718
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   719
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   720
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   721
    "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
   722
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   723
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   724
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   725
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   726
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   727
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   728
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   729
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   730
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   731
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   732
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   733
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   734
    "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
   735
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   736
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   737
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   738
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   739
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   740
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   741
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   742
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   743
    "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
   744
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   745
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   746
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   747
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   748
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   749
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   750
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   751
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   752
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   753
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   754
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   755
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   756
    if (aButton == __MKSMALLINT(1)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   757
        RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   758
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   759
    if (aButton == __MKSMALLINT(2)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   760
        RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   761
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   762
    if (aButton == __MKSMALLINT(3)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   763
        RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   764
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   765
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   766
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   767
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   768
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   769
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   770
    "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
   771
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   772
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   773
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   774
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   775
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   776
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   777
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   778
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
   779
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
   780
48194c26a46c Initial revision
claus
parents:
diff changeset
   781
%{  /* NOCONTEXT */
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   782
#ifndef WIN32
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   783
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   784
        RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   785
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   786
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   787
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   788
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   789
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   790
133
claus
parents: 132
diff changeset
   791
displayName
claus
parents: 132
diff changeset
   792
    "return the X-connections display name.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   793
     This is (currently) nil for the default display,
133
claus
parents: 132
diff changeset
   794
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
   795
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
   796
claus
parents: 132
diff changeset
   797
    ^ displayName
claus
parents: 132
diff changeset
   798
!
claus
parents: 132
diff changeset
   799
4153
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   800
displayName: something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   801
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   802
    displayName := something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   803
!
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
   804
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   805
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   806
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   807
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   808
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   809
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   810
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   811
        RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   812
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   813
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   814
%}
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
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   817
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   818
    "
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
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   821
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   822
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   823
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   824
     (to avoid bugs in certain implementations)"
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
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   827
        RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   828
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   829
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   830
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   831
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   832
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   833
     Display serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   834
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   835
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   836
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   837
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   838
    "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
   839
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   840
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
   841
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   842
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   843
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   844
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   845
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   846
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   847
     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
   848
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   849
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   850
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   851
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   852
    |x1 y1 x2 y2 rootWindowId|
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   853
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   854
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   855
    y1 := y2 := aPoint y truncated.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   856
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   857
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   858
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   859
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   860
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   861
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   862
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   863
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   864
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   865
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   866
     && __bothSmallInteger(x1, y1)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   867
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   868
        Window rootWin;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   869
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   870
        w1 = __WindowVal(windowId1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   871
        w2 = __WindowVal(windowId2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   872
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   873
        rootWin = RootWindow(dpy, screen);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   874
        if (w1 == rootWin) {
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   875
            w1 = (Window)__externalAddressVal(rootWindowId);
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   876
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   877
        if (w2 == rootWin) {
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   878
            w2 = (Window)__externalAddressVal(rootWindowId);
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   879
        }
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   880
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   881
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   882
        XTranslateCoordinates(dpy, w1, w2,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   883
                              __intVal(x1), __intVal(y1),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   884
                              &xpos, &ypos, &child_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   885
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   886
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   887
        x2 = __MKSMALLINT(xpos);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   888
        y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   889
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   890
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   891
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   892
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   893
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   894
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   895
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   896
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   897
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   898
     (to avoid bugs in certain implementations)"
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
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   901
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   902
        RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
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
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   905
%}
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
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   908
     Display vendorRelease
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
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   911
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   912
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   913
    "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
   914
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   915
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   916
     - 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
   917
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   918
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   919
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   920
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   921
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   922
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   923
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   924
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   925
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   926
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   927
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   928
     && __isPoint(aPoint)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   929
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   930
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   931
        xp = _point_X(aPoint);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   932
        yp = _point_Y(aPoint);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   933
        if (__bothSmallInteger(xp, yp)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   934
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   935
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   936
            XTranslateCoordinates(dpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   937
                                  RootWindow(dpy, screen),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   938
                                  __WindowVal(windowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   939
                                  __intVal(xp), __intVal(yp),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   940
                                  &xpos, &ypos, &child_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   941
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   942
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   943
            if (child_ret) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   944
                RETURN ( __MKEXTERNALADDRESS(child_ret) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   945
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   946
            RETURN ( nil );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   947
        }
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   948
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   949
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   950
    windowId notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   951
        aPoint isPoint ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   952
            ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   953
        ]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   954
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   955
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   956
    ^ nil
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   957
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   958
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   959
      Display viewIdFromPoint:100@100 in:Display realRootWindowId
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
   960
    "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   961
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   962
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   963
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   964
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   965
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   966
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   967
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   968
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   969
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   970
    if (ISCONNECTED
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   971
     && (__INST(rootId) != __INST(virtualRootId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   972
     && __isExternalAddress(__INST(virtualRootId))) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   973
        Window vRootWin;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   974
        Window root;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   975
        int x, y;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   976
        unsigned int width, height;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   977
        unsigned int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   978
        int ret;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   979
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   980
        vRootWin = __WindowVal(__INST(virtualRootId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   981
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   982
        ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   983
                                          &dummy, &dummy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   984
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   985
        if (ret) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   986
            RETURN ( __MKPOINT_INT(width, height) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
   987
        }
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   988
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   989
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   990
    ^ width @ height
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   991
   "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   992
     Display virtualExtent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   993
     Display extent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
   994
   "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   995
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   996
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   997
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   998
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   999
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1000
    ^ whitepixel
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1001
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1002
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1003
xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1004
    ^ xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1005
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1006
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1007
xlibTimeout:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1008
    xlibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1009
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1010
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1011
xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1012
    ^ xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1013
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1014
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1015
xlibTimeoutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1016
    xlibTimeoutForWindowCreation := seconds
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1017
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1018
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
  1019
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1020
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1021
hasDPS
186
claus
parents: 180
diff changeset
  1022
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
  1023
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
  1024
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1025
48194c26a46c Initial revision
claus
parents:
diff changeset
  1026
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
  1027
claus
parents: 180
diff changeset
  1028
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1029
     Display hasDPS
186
claus
parents: 180
diff changeset
  1030
    "
claus
parents: 180
diff changeset
  1031
!
claus
parents: 180
diff changeset
  1032
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1033
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1034
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1035
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
  1036
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
  1037
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1038
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1039
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1040
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1041
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1042
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1043
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1044
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1045
     && __isStringLike(extensionString)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1046
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1047
        if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1048
            rslt = true;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1049
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1050
        LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1051
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1052
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1053
%}
186
claus
parents: 180
diff changeset
  1054
claus
parents: 180
diff changeset
  1055
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1056
     Display hasExtension:'XVideo'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1057
     Display hasExtension:'Input'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1058
     Display hasExtension:'GLX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1059
     Display hasExtension:'X3D-PEX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1060
     Display hasExtension:'XInputExtension'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1061
     Display hasExtension:'SHAPE'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1062
     Display hasExtension:'MIT-SHM'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1063
     Display hasExtension:'SGIFullScreenStereo'
186
claus
parents: 180
diff changeset
  1064
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1065
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1066
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1067
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1068
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1069
     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
  1070
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1071
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1072
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1073
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1074
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1075
     Display hasImageExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1076
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1077
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1079
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1080
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1081
     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
  1082
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1083
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1084
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1085
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1086
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1087
     Display hasInputExtension
295
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1090
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1091
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1092
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1093
     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
  1094
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1095
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1096
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1097
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1098
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1099
     Display hasMultibuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1100
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1101
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1102
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1103
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1104
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1105
     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
  1106
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1107
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1108
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1109
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1110
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1111
     Display hasPEX
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1112
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1113
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1114
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1115
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1116
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1117
     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
  1118
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1119
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1120
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1121
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1122
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1123
     Display hasShm
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1124
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1125
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1126
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1127
hasXVideo
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1128
    "return true, if this workstation supports the XVideo extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1129
     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
  1130
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1131
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1132
    ^ hasXVideoExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1133
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1134
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1135
     Display hasXVideo
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1136
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1137
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1138
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1139
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1140
    "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
  1141
     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
  1142
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1143
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1144
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1145
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1146
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1147
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1148
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1149
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1150
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1151
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1152
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1153
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1154
        int status;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1155
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1156
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1157
        status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1158
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1159
        if (status > 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1160
           xIconSizes = __MKEXTERNALBYTES(sizeList);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1161
           count = __MKSMALLINT(cnt);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1162
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1163
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1164
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1165
    xIconSizes isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1166
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1167
    ret := OrderedCollection new:count.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1168
    1 to:count do:[ :i |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1169
        |minWidth minHeight maxWidth maxHeight widthStep heightStep d|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1170
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1171
%{
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1172
        XIconSize *slp;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1173
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1174
        slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1175
        minWidth = __MKSMALLINT(slp->min_width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1176
        minHeight = __MKSMALLINT(slp->min_height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1177
        maxWidth = __MKSMALLINT(slp->max_width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1178
        maxHeight = __MKSMALLINT(slp->max_height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1179
        widthStep = __MKSMALLINT(slp->width_inc);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1180
        heightStep = __MKSMALLINT(slp->height_inc);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1181
%}.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1182
        d := IdentityDictionary new.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1183
        d at:#minWidth put:minWidth.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1184
        d at:#maxWidth put:maxWidth.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1185
        d at:#widthStep put:widthStep.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1186
        d at:#minHeight put:minHeight.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1187
        d at:#maxHeight put:maxHeight.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1188
        d at:#heightStep put:heightStep.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1189
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1190
        ret add:d
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1191
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1192
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1193
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1194
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1195
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1196
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1197
     Display iconSizes
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1198
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1199
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1200
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1201
ignoreBackingStore:aBoolean
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1202
    "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
  1203
     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
  1204
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1205
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1206
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1207
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1208
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1209
monitorBounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1210
    "ask the X server via the Xinerama extension about the available minitors.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1211
     The first monitor returned is the primary monitor"
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1212
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1213
    |numberOfMonitors resultArray bounds|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1214
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1215
%{
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1216
#ifdef XINERAMA
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1217
    if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1218
        Display *dpy = myDpy;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1219
        XineramaScreenInfo *screenInfo; 
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1220
        int numDisplays;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1221
        OBJ *cResultArray;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1222
        int i, ci;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1223
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1224
        screenInfo = XineramaQueryScreens (dpy, &numDisplays);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1225
        if (screenInfo == 0) {
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1226
            goto out;
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1227
        }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1228
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1229
        numberOfMonitors = __mkSmallInteger(numDisplays);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1230
        resultArray = __ARRAY_NEW_INT(numDisplays * 5);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1231
        cResultArray = __ArrayInstPtr(resultArray)->a_element;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1232
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1233
        for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1234
            cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1235
            cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1236
            cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1237
            cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1238
            cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1239
        }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1240
    
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1241
        XFree(screenInfo);
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1242
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1243
#endif
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1244
out:;
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1245
%}.
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1246
    numberOfMonitors isNil ifTrue:[
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1247
        "no xinerama - the display is the only monitor"
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1248
        ^ Array with:self bounds.
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1249
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1250
    rawMonitorBounds = resultArray ifTrue:[
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1251
        ^ monitorBounds.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1252
    ].
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1253
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1254
    bounds := Array new:numberOfMonitors.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1255
    1 to:numberOfMonitors do:[:idx|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1256
        |rect baseIdx|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1257
        baseIdx := (idx-1) * 5.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1258
        rect := Rectangle 
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1259
                    left:(resultArray at:baseIdx+2)
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1260
                    top:(resultArray at:baseIdx+3)
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1261
                    width:(resultArray at:baseIdx+4)
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1262
                    height:(resultArray at:baseIdx+5).
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1263
        bounds at:idx put:rect.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1264
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1265
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1266
    rawMonitorBounds := resultArray.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1267
    monitorBounds := bounds.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1268
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1269
    "since the monitor configuration changed,
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1270
     we have to update the monitor settings"
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1271
5892
491bf533899e added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5891
diff changeset
  1272
    self initializeScreenBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1273
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1274
    ^ bounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1275
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1276
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1277
     Display monitorBounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1278
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1279
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1280
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1281
monitorBoundsAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1282
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1283
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1284
    bounds := self monitorBounds.
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1285
    ^ bounds 
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1286
        detect:[:eachRectangle| eachRectangle containsPoint:aPoint]
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1287
        ifNone:[super monitorBoundsAt:aPoint].
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1288
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1289
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1290
     Screen current monitorBoundsAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1291
     Screen current monitorBoundsAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1292
     Screen current monitorBoundsAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1293
     Screen current monitorBoundsAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1294
     Screen current monitorBoundsAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1295
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1296
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1297
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1298
numberOfMonitors
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1299
    ^ self monitorBounds size
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1300
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1301
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1302
        Display numberOfMonitors
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1303
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1304
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1305
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1306
pointIsVisible:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1307
    "is the point visible?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1308
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1309
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1310
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1311
    bounds := self monitorBounds.
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1312
    ^ bounds contains:[:eachRectangle| eachRectangle containsPoint:aPoint].
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1313
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1314
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1315
     Screen current pointIsVisible:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1316
     Screen current pointIsVisible:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1317
     Screen current pointIsVisible:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1318
     Screen current pointIsVisible:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1319
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1320
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1321
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1322
pointsAreOnSameMonitor:point1 and:point2
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1323
    "are the two points on the same (multi-screen) monitors?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1324
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1325
    ^ (self monitorBoundsAt:point1) = (self monitorBoundsAt:point2)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1326
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1327
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1328
preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1329
    "return the displays preferred size for icons.
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1330
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1331
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1332
    self serverVendor = 'Silicon Graphics' ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1333
        ^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1334
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1335
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1336
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1337
    "Created: 10.6.1996 / 21:06:48 / cg"
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1338
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1339
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1340
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1341
    "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
  1342
     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
  1343
     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
  1344
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1345
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1346
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1347
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1348
smallestMonitorHeight
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1349
    "returns the usable height of the smallest monitor in a mult-monito setup"
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1350
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1351
    |minH|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1352
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1353
    minH := self usableHeight.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1354
    self monitorBounds do:[:eachBounds |
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1355
        minH := minH min: eachBounds height.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1356
    ].
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1357
    ^ minH
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1358
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1359
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1360
        Display smallestMonitorHeight
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1361
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1362
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1363
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1364
supportedImageFormats
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1365
    "return an array with supported image formats;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1366
     each array entry is an attribute dictionary, consisting of
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1367
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1368
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1369
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1370
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1371
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1372
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1373
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1374
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1375
        RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1376
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1377
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1378
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1379
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1380
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1381
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1382
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1383
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1384
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1385
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1386
    1 to:nFormats do:[:index |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1387
        |info bitsPerPixelInfo depthInfo paddingInfo i|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1388
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1389
        i := index.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1390
%{
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1391
        ScreenFormat *format;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1392
        Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1393
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1394
#ifdef NO_PRIVATE_DISPLAY_ACCESS
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1395
        depthInfo = __MKSMALLINT(1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1396
        bitsPerPixelInfo = __MKSMALLINT(1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1397
        paddingInfo = __MKSMALLINT(8);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1398
#else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1399
        format = DISPLAYACCESS(dpy)->pixmap_format;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1400
        format += (__intVal(i)-1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1401
        bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1402
        depthInfo = __MKSMALLINT(format->depth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1403
        paddingInfo = __MKSMALLINT(format->scanline_pad);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1404
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1405
%}.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1406
        info := IdentityDictionary new.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1407
        info at:#depth put:depthInfo.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1408
        info at:#bitsPerPixel put:bitsPerPixelInfo.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1409
        info at:#padding put:paddingInfo.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1410
        formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1411
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1412
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1413
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1414
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1415
     Display supportedImageFormats
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1416
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1417
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1418
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1419
supportsAnyViewBackgroundPixmaps
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1420
    "return true, if the device allows pixmaps as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1421
     viewBackground."
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1422
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1423
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1424
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1425
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1426
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1427
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1428
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1429
    "return true, if this workstation supports arbitrary shaped windows.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1430
     Both the server must support it (the shape-extension),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1431
     and the feature must have been enabled in the smalltalk system,
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1432
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1433
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1434
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1435
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1436
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1437
     Display supportsArbitraryShapedViews
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1438
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1439
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1440
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1441
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1442
    "return true, if this device supports views as icons.
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1443
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1444
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1445
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1446
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1447
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1448
     Display supportsIconViews
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1449
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1450
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1451
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1452
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1453
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1454
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1455
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1456
    "return true, if the device allows the given form pixmap
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1457
     to be used as paint color.
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1458
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1459
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1460
    ^ true
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1461
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1462
    "Created: / 4.5.1999 / 12:16:43 / cg"
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1463
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1464
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1465
supportsViewBackgroundPixmap:aForm
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1466
    "return true, if the device allows the given pixmap as
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1467
     viewBackground.
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1468
     True returned here - X support any size."
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1469
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1470
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1471
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1472
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1473
    "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
  1474
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1475
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1476
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1477
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1478
     We do not depend on it being implemented, but some resizing operations
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1479
     are faster, it is is."
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1480
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1481
    ^ true
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1482
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1483
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1484
usableHeightAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1485
    "returns the usable height of the display (in pixels) at a given point
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1486
     Normally, the same as height, but may be smaller, in
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1487
     case some menu space is taken up by the window manager (windows).
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1488
     On multi-display systems with different sized screens, this should care for
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1489
     which display is at the given x-position"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1490
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1491
    ^ (self monitorBoundsAt:aPoint) height.
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1492
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1493
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1494
     Screen current usableHeightAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1495
     Screen current usableHeightAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1496
     Screen current usableHeightAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1497
     Screen current usableHeightAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1498
     Screen current usableHeightAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1499
    "
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1500
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1501
48194c26a46c Initial revision
claus
parents:
diff changeset
  1502
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1503
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1504
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1505
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1506
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1507
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1508
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1509
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1510
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1511
    bitmapId isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1512
        self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1513
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1514
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1515
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1516
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1517
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1518
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1519
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1520
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1521
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1522
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1523
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1524
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1525
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1526
     && __isStringLike(aString)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1527
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1528
        char *filename;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1529
        int status;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1530
        Pixmap newBitmap;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1531
        unsigned b_width, b_height;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1532
        int b_x_hot, b_y_hot;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1533
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1534
        filename = (char *) __stringVal(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1535
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1536
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1537
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1538
        status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1539
                                 filename, &b_width, &b_height, &newBitmap,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1540
                                 &b_x_hot, &b_y_hot);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1541
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1542
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1543
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1544
        if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1545
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1546
            __cnt_bitmap++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1547
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1548
            w = __MKSMALLINT(b_width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1549
            h = __MKSMALLINT(b_height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1550
            id = __MKEXTERNALADDRESS(newBitmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1551
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1552
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1553
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1554
    id notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1555
        aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1556
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1557
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1558
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1559
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1560
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1561
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1562
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1563
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1564
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1565
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1566
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1567
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1568
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1569
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1570
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1571
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1572
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1573
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1574
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1575
        newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1576
                                       __intVal(w), __intVal(h), 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1577
        LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1578
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1579
        if (newBitmap)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1580
            __cnt_bitmap++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1581
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1582
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1583
        RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1584
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1585
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1586
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1587
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1588
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1589
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1590
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  1591
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  1592
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1593
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1594
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1595
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1596
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1597
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1598
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1599
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1600
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1601
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1602
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1603
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1604
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1605
        newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1606
                                       __intVal(w), __intVal(h), __intVal(d));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1607
        LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1608
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1609
        if (newBitmap)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1610
            __cnt_bitmap++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1611
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1612
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1613
        RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1614
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  1615
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1616
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1617
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1618
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1619
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1620
createWindowFor:aView type:typeSymbol
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1621
                 origin:origin
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1622
                 extent:extent
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1623
                 minExtent:minExt
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1624
                 maxExtent:maxExt
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1625
                 borderWidth:bWidth
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1626
                 subViewOf:wsuperView
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1627
                 style:wStyle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1628
                 inputOnly:winputOnly
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1629
                 label:wlabel
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1630
                 owner:wowner
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1631
                 icon:wicon iconMask:wiconMask
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1632
                 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1633
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1634
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1635
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1636
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1637
     bColorId wsuperViewId windowId
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1638
     weventMask bitGravity viewGravity vBgColor
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1639
     vBgForm deepForm preferredVisual preferredDepth 
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1640
     wiconId wiconMaskId wiconViewId|
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1641
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1642
    displayId isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1643
        self primitiveFailedOrClosedConnection.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1644
        ^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1645
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1646
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1647
    origin notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1648
        xpos := origin x.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1649
        ypos := origin y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1650
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1651
        xpos := ypos := 0.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1652
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1653
    extent notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1654
        wwidth := extent x.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1655
        wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1656
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1657
        wwidth := wheight := 100.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1658
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1659
    minExt notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1660
        minWidth := minExt x.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1661
        minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1662
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1663
    maxExt notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1664
        maxWidth := maxExt x.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1665
        maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1666
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1667
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1668
    wsuperView notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1669
        wsuperViewId := wsuperView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1670
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1671
48194c26a46c Initial revision
claus
parents:
diff changeset
  1672
    wicon notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1673
        wiconId := wicon id.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1674
        wiconMask notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1675
            wiconMaskId := wiconMask id
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1676
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1677
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1678
    wiconView notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1679
        wiconViewId := wiconView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1680
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1681
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1682
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1683
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1684
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1685
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1686
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1687
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1688
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1689
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1690
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1691
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1692
    XSizeHints sizehints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1693
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1694
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1695
    XFontStruct *f;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1696
    Pixmap backPixmap = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1697
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1698
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1699
    Atom WmQuitAppAtom, MotifWMHintsAtom;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  1700
    Atom STXDeviceAtom, UUIDAtom;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1701
    Atom atoms[3];
48194c26a46c Initial revision
claus
parents:
diff changeset
  1702
    int atomCount = 0, isTopWindow = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1703
48194c26a46c Initial revision
claus
parents:
diff changeset
  1704
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1705
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1706
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1707
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1708
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1709
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1710
    if (__bothSmallInteger(wwidth, wheight)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1711
        sizehints.flags |= PSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1712
        sizehints.width = __intVal(wwidth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1713
        sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1714
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1715
    if (__bothSmallInteger(xpos, ypos)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1716
        sizehints.flags |= PPosition;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1717
        sizehints.x = __intVal(xpos);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1718
        sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1719
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1720
    if (__bothSmallInteger(minWidth, minHeight)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1721
        sizehints.flags |= PMinSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1722
        sizehints.min_width = __intVal(minWidth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1723
        sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1724
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1725
    if (__bothSmallInteger(maxWidth, maxHeight)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1726
        sizehints.flags |= PMaxSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1727
        sizehints.max_width = __intVal(maxWidth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1728
        sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1729
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1730
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  1731
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1732
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1733
    if (__isSmallInteger(bWidth)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1734
        bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1735
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1736
        bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1737
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1738
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1739
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1740
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1741
    if (__isExternalAddress(wsuperViewId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1742
        parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1743
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1744
        parentWindow = RootWindow(dpy, screen);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1745
        isTopWindow = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1746
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1747
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1748
    if (wStyle == @symbol(popUp))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1749
        xswa.override_redirect = 1;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1750
    else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1751
        xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1752
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1753
    if (winputOnly == true)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1754
        ioClass = InputOnly;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1755
    else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1756
        ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1757
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1758
    if (__isSmallInteger(weventMask)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1759
        xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1760
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1761
        xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1762
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1763
48194c26a46c Initial revision
claus
parents:
diff changeset
  1764
    if (ioClass == InputOnly) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1765
        bw = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1766
        depth = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1767
        flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1768
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1769
        depth = DefaultDepth(dpy,screen);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1770
        flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1771
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1772
        if (backPixmap != (Pixmap)0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1773
            xswa.background_pixmap = backPixmap;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1774
            flags |= CWBackPixmap;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1775
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1776
            xswa.background_pixel = bg;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1777
            flags |= CWBackPixel;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1778
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1779
        xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1780
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1781
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1782
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1783
    if (__isSmallInteger(preferredDepth)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1784
        depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1785
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1786
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1787
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1788
    if (preferredVisual != nil) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1789
        XVisualInfo vi;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1790
        int cls;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1791
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1792
        if (preferredVisual == @symbol(StaticGray))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1793
            cls = StaticGray;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1794
        else if (preferredVisual == @symbol(GrayScale))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1795
            cls = GrayScale;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1796
        else if (preferredVisual == @symbol(StaticColor))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1797
            cls = StaticColor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1798
        else if (preferredVisual == @symbol(PseudoColor))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1799
            cls = PseudoColor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1800
        else if (preferredVisual == @symbol(TrueColor))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1801
            cls = TrueColor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1802
        else if (preferredVisual == @symbol(DirectColor))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1803
            cls = DirectColor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1804
        else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1805
            cls = PseudoColor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1806
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1807
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1808
        if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1809
            visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  1810
/*
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1811
            console_fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  1812
*/
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1813
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1814
        LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1815
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1816
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1817
    ENTER_XLIB2();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1818
    newWindow = XCreateWindow(dpy, parentWindow,
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1819
                           sizehints.x, sizehints.y,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1820
                           sizehints.width, sizehints.height,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1821
                           bw, depth, ioClass, &visual,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1822
                           flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1823
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1824
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1825
48194c26a46c Initial revision
claus
parents:
diff changeset
  1826
    if (! newWindow) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1827
        RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1828
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1829
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1830
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1831
    __cnt_view++;
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
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1834
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  1835
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  1836
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  1837
     */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1838
    if (isTopWindow) {
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1839
        XWMHints wmhints;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1840
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1841
        wmhints.flags = 0;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1842
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1843
        if (__isExternalAddress(wiconId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1844
            wmhints.icon_pixmap = __PixmapVal(wiconId);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1845
            wmhints.flags = IconPixmapHint;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1846
            if (__isExternalAddress(wiconMaskId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1847
                wmhints.icon_mask = __PixmapVal(wiconMaskId);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1848
                wmhints.flags |= IconMaskHint;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1849
            }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1850
        }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1851
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1852
        if (__isExternalAddress(wiconViewId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1853
            wmhints.flags |= IconWindowHint;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1854
            wmhints.icon_window = __WindowVal(wiconViewId);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1855
        };
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1856
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1857
/*
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1858
        wmhints.flags |= InputHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1859
        wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1860
*/
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1861
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1862
        XSetWMHints(dpy, newWindow, &wmhints);
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  1863
        XSetWMNormalHints(dpy, newWindow, &sizehints);
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1864
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1865
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1866
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1867
         * get atoms first (if not already known)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1868
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1869
        if (__INST(protocolsAtom) == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1870
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1871
            WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1872
            __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1873
#ifdef USE_SAVEYOURSELF_ATOM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1874
            WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1875
            __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1876
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1877
#ifdef USE_QUIT_APP_ATOM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1878
            WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1879
            __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1880
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1881
            WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1882
            __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1883
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1884
            UUIDAtom = XInternAtom(dpy, "UUID", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1885
            __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1886
            STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1887
            __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1888
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1889
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1890
        } else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1891
#ifdef USE_QUIT_APP_ATOM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1892
            WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1893
#else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1894
            WmQuitAppAtom = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1895
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1896
            WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1897
            WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1898
#ifdef USE_SAVEYOURSELF_ATOM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1899
            WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1900
#else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1901
            WmSaveYourselfAtom = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1902
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1903
            UUIDAtom = __AtomVal(__INST(uuidAtom));;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1904
            STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1905
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1906
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1907
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1908
         * tell window manager to not kill us but send an event instead
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1909
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1910
        atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1911
#ifdef USE_SAVEYOURSELF_ATOM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1912
        atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1913
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1914
#ifdef USE_QUIT_APP_ATOM
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1915
        atoms[atomCount] = WmQuitAppAtom; atomCount++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1916
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1917
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1918
        XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1919
                        32, PropModeReplace, (unsigned char *)atoms, atomCount);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1920
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1921
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1922
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1923
         * an optional unique id (to mark stx-windows)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1924
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1925
        if (__isBytes(__INST(uniqueDeviceID))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1926
            int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1927
            unsigned char uuidBytes[32];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1928
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1929
            if (numUUIDBytes <= sizeof(uuidBytes)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1930
                Atom uuidAtom;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1931
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1932
                bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1933
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1934
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1935
                XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1936
                                 uuidBytes, numUUIDBytes );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1937
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1938
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1939
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1940
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  1941
#ifdef SUPPORT_MOTIF_WM_HINTS
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1942
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1943
         * less decoration
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1944
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1945
        if ((wStyle == @symbol(undecorated))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1946
         || (wStyle == @symbol(dialog2))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1947
         || (wStyle == @symbol(notitle))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1948
        ) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1949
            if (__INST(motifWMHintsAtom) == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1950
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1951
                MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1952
                __INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1953
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1954
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1955
                MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1956
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1957
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1958
            {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1959
                struct hints {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1960
                    unsigned long flags;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1961
                    unsigned long functions;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1962
                    unsigned long decorations;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1963
                    long input_mode;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1964
                    unsigned long status;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1965
                } mvm_hints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1966
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1967
                if (wStyle == @symbol(undecorated)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1968
                    mvm_hints.decorations = MWM_DECOR_NONE;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1969
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1970
                if (wStyle == @symbol(dialog2)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1971
                    mvm_hints.decorations = MWM_DECOR_BORDER
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1972
                                            | MWM_DECOR_RESIZEH
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1973
                                            | MWM_DECOR_TITLE
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1974
                                            /* | MWM_DECOR_MENU */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1975
                                            /* | MWM_DECOR_MINIMIZE */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1976
                                            /* | MWM_DECOR_MAXIMIZE */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1977
                                            ;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1978
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1979
                if (wStyle == @symbol(notitle)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1980
                    mvm_hints.decorations = MWM_DECOR_BORDER
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1981
                                            /* | MWM_DECOR_RESIZEH  */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1982
                                            /* | MWM_DECOR_TITLE    */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1983
                                            /* | MWM_DECOR_MENU     */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1984
                                            /* | MWM_DECOR_MINIMIZE */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1985
                                            /* | MWM_DECOR_MAXIMIZE */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1986
                                            ;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1987
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1988
                mvm_hints.flags =  MWM_HINTS_DECORATIONS;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1989
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1990
                XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1991
                                     MotifWMHintsAtom, 32, PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1992
                                     (unsigned char*)&mvm_hints, 5 );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1993
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  1994
            }
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  1995
        }
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  1996
#endif /* SUPPORT_MOTIF_WM_HINTS */
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1997
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1998
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1999
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2000
%}.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2001
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2002
"/    (wStyle ~= nil and:[wStyle ~= #normal]) ifTrue:[
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2003
"/        self setWindowType:wStyle in:windowId.
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2004
"/    ].
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2005
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2006
    (wsuperView isNil "this is a topwindow"
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2007
     and:[wlabel notEmptyOrNil]) ifTrue:[
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2008
        self 
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2009
            setIconName:wlabel in:windowId;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2010
            setWindowName:wlabel in:windowId.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2011
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2012
5568
3d18b7fa928a changed: #createWindowFor:type:origin:extent:minExtent:maxExtent:borderWidth:subViewOf:style:inputOnly:label:owner:icon:iconMask:iconView:
Stefan Vogel <sv@exept.de>
parents: 5528
diff changeset
  2013
    self addKnownView:aView withId:windowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2014
    ^ windowId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2015
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2016
48194c26a46c Initial revision
claus
parents:
diff changeset
  2017
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2018
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2019
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2020
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2021
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2022
     * ignore closed connection
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2023
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2024
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2025
        RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2026
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2027
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2028
    if (__isExternalAddress(aGCId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2029
        GC gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2030
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2031
        if (gc) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2032
            __ExternalAddressInstPtr(aGCId)->e_address = NULL;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2033
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2034
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2035
            XFreeGC(myDpy, gc);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2036
            LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2037
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2038
            __cnt_gc--;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2039
#endif
5716
27e02ce4e72a changed: #destroyGC:
Stefan Vogel <sv@exept.de>
parents: 5586
diff changeset
  2040
        } else {
27e02ce4e72a changed: #destroyGC:
Stefan Vogel <sv@exept.de>
parents: 5586
diff changeset
  2041
            console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n");
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2042
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2043
        RETURN ( self );
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2044
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2045
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2046
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2047
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2048
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2049
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2050
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2051
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2052
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2053
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2054
     * ignore closed connection
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2055
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2056
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2057
        RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2058
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2059
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2060
    if (__isExternalAddress(aDrawableId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2061
        Pixmap pix = __PixmapVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2062
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2063
        if (pix) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2064
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2065
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2066
            XFreePixmap(myDpy, pix);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2067
            LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2068
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2069
            __cnt_bitmap--;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2070
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2071
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2072
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2073
        RETURN ( self );
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2074
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2075
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2076
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2077
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2079
destroyView:aView withId:aWindowId
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2080
    self primDestroyView:aView withId:aWindowId.
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2081
    self removeKnownView:aView withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2082
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2083
48194c26a46c Initial revision
claus
parents:
diff changeset
  2084
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2085
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2086
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2087
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2088
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2089
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2090
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2091
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2092
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2093
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2094
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2095
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2096
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2097
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2098
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2099
        dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2100
                                       __GCVal(aGCId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2101
                                       0, height, 0, colormap, NULL, 0,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2102
                                       XDPSDefaultTextBackstop,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2103
                                       XDPSDefaultErrorProc,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2104
                                       NULL);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2105
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2106
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2107
        RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2108
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2109
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2110
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2111
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2112
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2113
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2114
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2115
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2116
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2117
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2118
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2119
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2120
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2121
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2122
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2123
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2124
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2125
        gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2126
        LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2127
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2128
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2129
        if (gc)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2130
            __cnt_gc++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2131
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2132
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2133
        RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2134
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2135
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2136
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2137
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2138
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2139
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2140
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2141
    "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
  2142
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2143
    ^ self gcFor:aDrawableId
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2146
primCreateBitmapFromArray:anArray width:w height:h
154
claus
parents: 153
diff changeset
  2147
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2148
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2149
154
claus
parents: 153
diff changeset
  2150
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2151
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2152
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2153
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2154
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2155
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2156
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2157
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2158
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2159
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2160
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2161
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2162
    static char reverseBitTable[256];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2163
    static firstCall = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2164
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2165
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2166
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2167
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2168
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2169
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2170
        RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2171
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2172
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2173
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2174
    if (firstCall) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2175
        for (index=0; index < 256; index++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2176
            int t = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2177
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2178
            if (index & 128) t |=   1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2179
            if (index &  64) t |=   2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2180
            if (index &  32) t |=   4;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2181
            if (index &  16) t |=   8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2182
            if (index &   8) t |=  16;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2183
            if (index &   4) t |=  32;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2184
            if (index &   2) t |=  64;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2185
            if (index &   1) t |= 128;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2186
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2187
            reverseBitTable[index] = t;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2188
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2189
        firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2190
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2191
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2192
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2193
        newBitmap = (Pixmap)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2194
        b_width = __intVal(w);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2195
        b_height = __intVal(h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2196
        bytesPerRow = (b_width + 7) / 8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2197
        nBytes = b_height * bytesPerRow;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2198
        if (nBytes < sizeof(fastBits)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2199
            cp = b_bits = fastBits;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2200
            allocatedBits = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2201
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2202
            cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2203
            if (! cp) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2204
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2205
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2206
        if (__isArrayLike(anArray)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2207
            index = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2208
            op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2209
            for (row = b_height; row; row--) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2210
                for (col = bytesPerRow; col; col--) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2211
                    num = *op++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2212
                    if (__isSmallInteger(num)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2213
                        bits = __intVal(num);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2214
                    } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2215
                        bits = __longIntVal(num);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2216
                        if (bits == 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2217
                            goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2218
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2219
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2220
                    *cp++ = reverseBitTable[bits & 0xFF];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2221
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2222
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2223
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2224
            if (__isByteArrayLike(anArray)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2225
                pBits = __ByteArrayInstPtr(anArray)->ba_element;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2226
                for (col = b_height*bytesPerRow; col; col--) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2227
                    *cp++ = reverseBitTable[*pBits++];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2228
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2229
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2230
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2231
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2232
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2233
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2234
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2235
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2236
        newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2237
                                               (char *)b_bits,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2238
                                               b_width, b_height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2239
        LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2240
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2241
        if (newBitmap)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2242
            __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2243
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2244
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2245
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2246
fail: ;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2247
        if (allocatedBits)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2248
            free(allocatedBits);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2249
        RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2250
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2251
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2252
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2253
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2254
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2255
primCreateWindowType:t origin:o extent:e minExtent:minE maxExtent:maxE borderWidth:bw superViewId:sv style:st inputOnly:i label:l ownerId:oId iconId:ic iconMaskId:im iconViewId:iv
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2256
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2257
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2258
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2259
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2260
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2261
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2262
primDestroyView:aView withId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2263
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2264
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2265
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2266
        RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2267
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2268
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2269
    if (__isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2270
        Window win = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2271
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2272
        if (win) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2273
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2274
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2275
            XDestroyWindow(myDpy, win);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2276
            LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2277
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2278
            __cnt_view--;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2279
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2280
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2281
        }
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2282
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2283
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2284
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2285
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2286
!XWorkstation methodsFor:'clipboard'!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2287
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2288
getPrimaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2289
    "Returns the contents of PRIMARY selection buffer"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2290
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2291
    ^ primaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2292
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2293
    "Created: / 27-03-2012 / 14:51:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2294
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2295
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2296
primaryBufferAsString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2297
    "return my current selection as a string"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2298
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2299
    |o|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2300
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2301
    o := self getPrimaryBuffer.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2302
    o isString ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2303
        ^ o string.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2304
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2305
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2306
    o isNil ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2307
        ^ ''
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2308
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2309
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2310
    o isStringCollection ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2311
        ^ o from:1
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2312
            to:o size
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2313
            asStringWith:Character cr
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2314
            compressTabs:false
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2315
            final:nil
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2316
            withEmphasis:false.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2317
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2318
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2319
    RecursiveStoreError handle:[:ex |
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2320
       ^ ''
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2321
    ] do:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2322
       ^ o storeString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2323
    ]
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2324
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2325
    "Created: / 13-02-1997 / 13:10:30 / cg"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2326
    "Modified: / 20-01-1998 / 14:11:01 / stefan"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2327
    "Created: / 27-03-2012 / 14:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2328
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2329
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2330
setPrimaryBuffer:aString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2331
    "Sets the contents of PRIMARY selection."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2332
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2333
    primaryBuffer := aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2334
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2335
    "Created: / 27-03-2012 / 14:41:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2336
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2337
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2338
setPrimaryText:aString ownerView:aView
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2339
    "Set the PRIMARY selection - both the local one, and tell the display
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2340
     that we have changed it (i.e. place it into the PRIMARY)."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2341
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2342
    |s viewID|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2343
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2344
    self setPrimaryBuffer:aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2345
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2346
    s := aString ? ''.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2347
    s isString ifFalse:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2348
        s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2349
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2350
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2351
    viewID := aView id.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2352
    viewID notNil ifTrue:[ "/ if the view is not already closed
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2353
        "/ for now - should add support to pass emphasis information too
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2354
        s := s string.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2355
        self setPrimaryText:s owner:viewID.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2356
    ]
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2357
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2358
    "Created: / 27-03-2012 / 14:46:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2359
! !
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2360
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2361
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2362
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2363
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2364
    "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
  2365
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2366
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2367
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2368
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2369
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2370
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2371
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2372
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2373
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2374
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2375
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2376
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2377
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2378
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2379
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2380
        ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2381
                                   &dummy, 0, &color.pixel, 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2382
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2383
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2384
        if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2385
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2386
            __cnt_color++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2387
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2388
            RETURN ( __MKSMALLINT(color.pixel) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2389
        }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2390
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2391
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2392
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2393
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2394
48194c26a46c Initial revision
claus
parents:
diff changeset
  2395
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
  2396
    "allocate a color with color name - return the color index (i.e. colorID).
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2397
     Dont use this method, colornames are mostly X specific"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2398
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2399
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2400
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2401
48194c26a46c Initial revision
claus
parents:
diff changeset
  2402
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2403
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2404
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2405
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2406
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2407
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2408
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2409
     && __isStringLike(aString)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2410
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2411
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2412
        colorname = (char *) __stringVal(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2413
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2414
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2415
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2416
        ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2417
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2418
        if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2419
#ifdef QUICK_TRUE_COLORS
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2420
            if (__INST(visualType) == @symbol(TrueColor)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2421
                id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2422
                id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2423
                id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2424
                RETURN ( __MKSMALLINT(id) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2425
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2426
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2427
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2428
            ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2429
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2430
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2431
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2432
        if (! ok) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2433
            RETURN ( nil );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2434
        }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2435
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2436
        __cnt_color++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2437
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2438
        RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2439
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2440
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2441
    ^ super colorNamed:aString
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2442
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2443
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2444
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
  2445
    "allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2446
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2447
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2448
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2449
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2450
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2451
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2452
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2453
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2454
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2455
    if (__bothSmallInteger(r, g)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2456
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2457
     && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2458
        ecolor.red = __intVal(r);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2459
        ecolor.green= __intVal(g);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2460
        ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2461
#ifdef QUICK_TRUE_COLORS
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2462
        if (__INST(visualType) == @symbol(TrueColor)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2463
            id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2464
            id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2465
            id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2466
            RETURN ( __MKSMALLINT(id) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2467
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2468
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2469
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2470
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2471
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2472
        ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2473
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2474
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2475
        if (! ok) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2476
            RETURN ( nil );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2477
        }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2478
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2479
        __cnt_color++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2480
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2481
        RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2482
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2483
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2484
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2485
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2486
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2487
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2488
    "given a color-component value in percent (0..65k), return the corresponding
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2489
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2490
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2491
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2492
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2493
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2494
     Display deviceColorValueToPercent:0
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2495
     Display deviceColorValueToPercent:16r8000
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2496
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2497
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2498
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2499
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2500
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2501
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2502
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2503
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2504
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2505
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2506
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2507
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2508
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2509
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2510
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2511
    if (__INST(visualType) == @symbol(TrueColor)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2512
        /* no need to do anything on TrueColor displays ... */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2513
        RETURN (self);
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2514
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2515
#endif
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2516
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2517
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2518
     * ignore closed connection
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2519
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2520
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2521
        RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2522
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2523
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2524
    if (__isSmallInteger(colorIndex)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2525
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2526
        color = (long) __intVal(colorIndex);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2527
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2528
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2529
        XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2530
        LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2531
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2532
        __cnt_color--;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2533
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2534
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2535
        RETURN ( self );
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2536
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2537
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2538
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2539
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2540
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2541
getScaledRGBFrom:index
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2542
    "get rgb components (0 .. 16rFFFF) of color in map at:index,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2543
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2544
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2545
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2546
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2547
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2548
    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
  2549
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2550
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2551
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2552
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2553
     && __isSmallInteger(index)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2554
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2555
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2556
        color.pixel = __intVal(index);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2557
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2558
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2559
        XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2560
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2561
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2562
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2563
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2564
         * have to compensate for an error in X ?, which does not scale
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2565
         * colors correctly if lesser than 16bits are valid in a color,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2566
         * (for example, color white on a 4bitsPerRGB server will Return
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2567
         * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2568
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2569
        bits = __intVal(__INST(bitsPerRGB));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2570
        scale = (1<<bits) - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2571
        shift = 16 - bits;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2572
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2573
        sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2574
        sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2575
        sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2576
        RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2577
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2578
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2579
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2580
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2581
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2582
getScaledRGBFromName:colorName
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2583
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2584
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2585
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2586
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2587
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2588
    XColor color;
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  2589
    double dr, dg, db;
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2590
    int sr, sg, sb;
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2591
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2592
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2593
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2594
     && __isStringLike(colorName)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2595
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2596
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2597
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2598
        if (XParseColor(dpy, DefaultColormap(dpy, screen),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2599
                             (char *) __stringVal(colorName), &color)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2600
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2601
             * have to compensate for an error in X ?, which does not scale
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2602
             * colors correctly if lesser than 16bits are valid in a color,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2603
             * (for example, color white on a 4bitsPerRGB server will Return
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2604
             * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2605
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2606
            bits = __intVal(__INST(bitsPerRGB));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2607
            scale = (1<<bits) - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2608
            shift = 16 - bits;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2609
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2610
            /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2611
            dr = color.red>>shift;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2612
            dg = color.green>>shift;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2613
            db = color.blue>>shift;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2614
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2615
            sr = (dr / scale) * 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2616
            sg = (dg / scale) * 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2617
            sb = (db / scale) * 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2618
            RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2619
        }
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2620
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2621
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2622
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2623
    ^ super getScaledRGBFromName:colorName
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  2624
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  2625
    "
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2626
        Screen current getScaledRGBFromName:'red'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2627
        Screen current getScaledRGBFromName:'orange'
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  2628
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2629
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2630
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2631
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2632
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2633
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2634
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2635
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2636
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2637
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  2638
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2639
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2640
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2641
    [aStream atEnd] whileFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2642
        line := aStream nextLine.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2643
        line notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2644
            "skip the r/g/b numbers"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2645
            index := 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2646
            [(line at:index) isSeparator] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2647
            [(line at:index) isDigit] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2648
            [(line at:index) isSeparator] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2649
            [(line at:index) isDigit] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2650
            [(line at:index) isSeparator] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2651
            [(line at:index) isDigit] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2652
            [(line at:index) isSeparator] whileTrue:[index := index + 1].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2653
            colorName := line copyFrom:index.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2654
            ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2655
                list add:colorName
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2656
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
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
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2660
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2661
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2662
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2663
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2664
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2665
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2666
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2667
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2668
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2669
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2670
    "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
  2671
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2672
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2673
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2674
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2675
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2676
    if (__isSmallInteger(aPercentage)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2677
        RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2678
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2679
    if (__isFloat(aPercentage)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2680
        RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2681
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2682
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2683
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2684
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2685
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2686
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
  2687
    "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
  2688
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2689
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2690
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2691
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2692
48194c26a46c Initial revision
claus
parents:
diff changeset
  2693
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2694
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2695
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2696
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2697
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2698
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2699
    if (__isSmallInteger(sred))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2700
        r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2701
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2702
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2703
    if (__isSmallInteger(sgreen))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2704
        g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2705
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2706
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2707
    if (__isSmallInteger(sblue))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2708
        b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2709
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2710
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2711
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2712
     && __isSmallInteger(index) && ok) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2713
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2714
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2715
        color.pixel = __intVal(index);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2716
        color.red = r;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2717
        color.green = g;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2718
        color.blue = b;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2719
        color.flags = DoRed | DoGreen | DoBlue;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2720
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2721
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2722
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2723
        XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2724
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2725
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2726
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2727
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2728
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2729
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2730
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2731
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2732
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2733
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2734
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2735
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2736
     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
  2737
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2738
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2739
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2740
    "/ 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
  2741
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2742
    ^ #(
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2743
        #upLeftArrow            "/ XC_top_left_arrow
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2744
        #upRightHand            "/ XC_hand1
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2745
        #upDownArrow            "/ XC_sb_v_double_arrow
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2746
        #leftRightArrow         "/ XC_sb_h_double_arrow
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2747
        #upLimitArrow           "/ XC_top_side
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2748
        #downLimitArrow         "/ XC_bottom_side
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2749
        #leftLimitArrow         "/ XC_left_side
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2750
        #rightLimitArrow        "/ XC_right_side
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2751
        #text                   "/ XC_xterm
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2752
        #upRightArrow           "/ XC_draft_large
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2753
        #leftHand               "/ XC_hand2
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2754
        #questionMark           "/ XC_question_arrow
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2755
        #cross                  "/ XC_X_cursor
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2756
        #wait                   "/ XC_watch
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2757
        #crossHair              "/ XC_tcross
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2758
        #origin                 "/ XC_ul_angle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2759
        #topLeft                "/ XC_ul_angle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2760
        #corner                 "/ XC_lr_angle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2761
        #bottomRight            "/ XC_lr_angle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2762
        #topRight               "/ XC_ur_angle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2763
        #bottomLeft             "/ XC_ll_angle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2764
        #square                 "/ XC_dotbox
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2765
        #fourWay                "/ XC_fleur
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2766
        #crossCursor            "/ XC_X_cursor
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2767
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2768
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2769
    "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
  2770
    "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
  2771
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2772
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2773
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2774
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2775
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2776
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2777
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2778
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2779
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2780
    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
  2781
    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
  2782
    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
  2783
    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
  2784
    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
  2785
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2786
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2787
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2788
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2789
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2790
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2791
     && __bothSmallInteger(fgG, fgB)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2792
     && __bothSmallInteger(bgR, bgG)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2793
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2794
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2795
        fgcolor.red = __intVal(fgR);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2796
        fgcolor.green= __intVal(fgG);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2797
        fgcolor.blue = __intVal(fgB);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2798
        bgcolor.red = __intVal(bgR);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2799
        bgcolor.green= __intVal(bgG);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2800
        bgcolor.blue = __intVal(bgB);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2801
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2802
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2803
        XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2804
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2805
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2806
        RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2807
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2808
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2809
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2810
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2811
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2812
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2813
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2814
     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
  2815
     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
  2816
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2817
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2818
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2819
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2820
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2821
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2822
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2823
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2824
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
  2825
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2826
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2827
    ^ self
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2828
        primCreateCursorSourceFormId:sourceForm id
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2829
        maskFormId:maskForm id
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2830
        hotX:hx hotY:hy
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2831
        width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2832
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2833
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2834
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2835
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2836
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2837
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2838
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2839
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2840
     * ignore closed connection
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2841
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2842
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2843
        RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2844
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2845
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2846
    if (__isExternalAddress(aCursorId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2847
        Cursor curs = __CursorVal(aCursorId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2848
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2849
        if (curs) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2850
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2851
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2852
            XFreeCursor(myDpy, curs);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2853
            LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2854
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2855
            __cnt_cursor--;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2856
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2857
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2858
        RETURN ( self );
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2859
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2860
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2861
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2862
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2863
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2864
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2865
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2866
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2867
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2868
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2869
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2870
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2871
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2872
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2873
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2874
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2875
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2876
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2877
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2878
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2879
        newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2880
        LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2881
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2882
        if (newCursor)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2883
            __cnt_cursor++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2884
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2885
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2886
        if (newCursor != (Cursor)0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2887
            RETURN (__MKEXTERNALADDRESS(newCursor));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2888
        }
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2889
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2890
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2891
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2892
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2893
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  2894
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2895
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2896
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2897
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2898
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2899
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2900
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2901
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2902
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2903
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2904
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2905
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2906
     && __bothSmallInteger(hx, hy)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2907
        fgColor.red = 0;        /* fg is black */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2908
        fgColor.green = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2909
        fgColor.blue = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2910
        bgColor.red = 0xFFFF;   /* bg is white */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2911
        bgColor.green = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2912
        bgColor.blue = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2913
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2914
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2915
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2916
        newCursor = XCreatePixmapCursor(myDpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2917
                                __PixmapVal(sourceId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2918
                                __PixmapVal(maskId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2919
                                &fgColor, &bgColor, __intVal(hx), __intVal(hy));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2920
        LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2921
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2922
        if (newCursor)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2923
            __cnt_cursor++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2924
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2925
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2926
        if (newCursor != (Cursor)0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2927
            RETURN (__MKEXTERNALADDRESS(newCursor));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2928
        }
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2929
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2930
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2931
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2932
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2933
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  2934
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2935
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2936
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2937
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2938
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2939
    "/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
  2940
    "/ 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
  2941
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2942
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2943
    (shape == #upLeftArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow)    %} "132" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2944
    (shape == #upRightHand)     ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1)             %} "58" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2945
    (shape == #upDownArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2946
    (shape == #leftRightArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2947
    (shape == #upLimitArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side)          %} "138" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2948
    (shape == #downLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side)       %} "16" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2949
    (shape == #leftLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side)         %} "70" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2950
    (shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side)        %} "96" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2951
    (shape == #text)            ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm)             %} "152" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2952
    (shape == #upRightArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large)       %} "44" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2953
    (shape == #leftHand)        ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2)             %} "60" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2954
    (shape == #questionMark)    ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow)    %} "92" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2955
    (shape == #cross)           ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2956
    (shape == #wait)            ifTrue:[ ^ %{ __MKSMALLINT(XC_watch)             %} "150" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2957
    (shape == #crossHair)       ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross)            %} "130" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2958
    ((shape == #origin)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2959
    or:[shape == #topLeft])     ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle)          %} "144" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2960
    ((shape == #corner)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2961
    or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle)          %} "78" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2962
    (shape == #topRight)        ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle)          %} "148" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2963
    (shape == #bottomLeft)      ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle)          %} "76" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2964
    (shape == #square)          ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox)            %} "40" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2965
    (shape == #fourWay)         ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur)             %} "52" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2966
    (shape == #crossCursor)     ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2967
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2968
"/    ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2969
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2970
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2971
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2972
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2973
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2974
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2975
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2976
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2977
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2978
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2979
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2980
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  2981
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2982
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2983
        "/ DND can drop files, file, dir, links, dirLink and text
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2984
        "/ check for this.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2985
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2986
        dropObjects isCollection ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2987
            dropColl := Array with:dropObjects
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2988
        ] ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2989
            dropColl := dropObjects
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2990
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2991
        anyFile := anyDir := anyText := anyOther := false.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2992
        dropColl do:[:aDropObject |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2993
            aDropObject isFileObject ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2994
                aDropObject theObject isDirectory ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2995
                    anyDir := true
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2996
                ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2997
                    anyFile := true
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2998
                ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2999
            ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3000
                aDropObject isTextObject ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3001
                    anyText := true
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3002
                ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3003
                    anyOther := true
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3004
                ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3005
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3006
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3007
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3008
        anyOther ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3009
            "/ DND does not support this ...
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3010
            'XWorkstation [info]: DND can only drop files or text' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3011
            ^ false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3012
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3013
        anyText ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3014
            (anyFile or:[anyDir]) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3015
                "/ DND does not support mixed types
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3016
                'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3017
                ^ false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3018
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3019
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3020
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3021
        dropCollSize := dropColl size.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3022
        anyFile ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3023
            dropType := #DndFiles.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3024
            dropCollSize == 1 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3025
                dropType := #DndFile
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3026
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3027
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3028
            anyDir ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3029
                dropType := #DndFiles.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3030
                dropCollSize == 1 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3031
                    dropType := #DndDir
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3032
                ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3033
            ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3034
                anyText ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3035
                    dropCollSize == 1 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3036
                        dropType := #DndText
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3037
                    ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3038
                        "/ can only drop a single text object
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3039
                        'XWorkstation [info]: DND can only drop a single text' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3040
                        ^ false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3041
                    ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3042
                ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3043
                    "/ mhmh ...
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3044
                    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3045
                    ^ false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3046
                ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3047
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3048
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3049
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3050
        dropTypeCode := self dndDropTypes indexOf:dropType.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3051
        dropTypeCode == 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3052
            'XWorkstation [info]: DND cannot drop this' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3053
            ^ false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3054
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3055
        dropTypeCode := dropTypeCode - 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3056
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3057
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3058
        "/ place the selection inTo the DndSelection property
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3059
        "/ of the rootView ...
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3060
        "/ ... need a single string, with 0-terminated parts.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3061
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3062
        strings := OrderedCollection new.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3063
        sz := 0.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3064
        dropColl do:[:anObject |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3065
            |s o|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3066
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3067
            o := anObject theObject.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3068
            anObject isFileObject ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3069
                o := o pathName
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3070
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3071
            s := o asString.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3072
            strings add:s.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3073
            sz := sz + (s size) + 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3074
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3075
        val := String new:sz.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3076
        idx := 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3077
        strings do:[:aString |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3078
            |sz|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3079
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3080
            sz := aString size.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3081
            val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3082
            idx := idx + sz.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3083
            val at:idx put:(Character value:0).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3084
            idx := idx + 1
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3085
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3086
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3087
        self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3088
            setProperty:(self atomIDOf:#DndSelection)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3089
            type:(self atomIDOf:#STRING)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3090
            value:val
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3091
            for:rootId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3092
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3093
        ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3094
            sendClientEvent:msgType
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3095
            format:32
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3096
            to:destinationId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3097
            propagate:true
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3098
            eventMask:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3099
            window:destinationId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3100
            data1:dropTypeCode
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3101
            data2:0
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3102
            data3:destinationId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3103
            data4:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3104
            data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3105
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3106
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3107
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3108
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3109
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  3110
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3111
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3112
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3113
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3114
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3115
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3116
    ^ #(
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3117
            DndUnknown      "/ 0
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3118
            DndRawData      "/ 1
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3119
            DndFile         "/ 2
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3120
            DndFiles        "/ 3
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3121
            DndText         "/ 4
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3122
            DndDir          "/ 5
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3123
            DndLink         "/ 6
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3124
            DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3125
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3126
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3127
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3128
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3129
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3130
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3131
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3132
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3133
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3134
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3135
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3136
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3137
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3138
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3139
        ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3140
            dndDrop:aCollectionOfDropObjects
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3141
            inWindowID:destinationId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3142
            position:destinationPoint
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3143
            rootPosition:rootPoint
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3144
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3145
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3146
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3147
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3148
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3149
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3150
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3151
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3152
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3153
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3154
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3155
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
  3156
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3157
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3158
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3159
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3160
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3161
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3162
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3163
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3164
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3165
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3166
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3167
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3168
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3169
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3170
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3171
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3172
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3173
     && __bothSmallInteger(dstX, dstY)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3174
        int _sX, _sY, _w, _h, _dX, _dY;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3175
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3176
        _sX = __intVal(srcX);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3177
        _sY = __intVal(srcY);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3178
        _w = __intVal(w);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3179
        _h = __intVal(h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3180
        _dX = __intVal(dstX);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3181
        _dY = __intVal(dstY);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3182
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3183
        gc = __GCVal(dstGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3184
        source = __DrawableVal(sourceId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3185
        dest =   __DrawableVal(destId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3186
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3187
        XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3188
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3189
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3190
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3191
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3192
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3193
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3194
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3195
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3196
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3197
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3198
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
  3199
    "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
  3200
     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
  3201
     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
  3202
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3203
     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
  3204
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3205
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3206
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3207
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3208
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3209
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3210
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3211
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3212
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3213
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3214
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3215
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3216
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3217
     && __bothSmallInteger(dstX, dstY)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3218
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3219
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3220
        gc = __GCVal(dstGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3221
        source = __DrawableVal(sourceId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3222
        dest =   __DrawableVal(destId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3223
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3224
        XSetGraphicsExposures(dpy, gc, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3225
        XCopyArea(dpy, source, dest, gc,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3226
                                __intVal(srcX), __intVal(srcY),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3227
                                __intVal(w), __intVal(h),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3228
                                __intVal(dstX), __intVal(dstY));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3229
        XSetGraphicsExposures(dpy, gc, 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3230
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3231
        RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3232
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3233
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3234
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3235
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3236
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3237
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3238
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3239
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3240
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3241
    "do a bit-blt, but only copy the low-bit plane;
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3242
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3243
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3244
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3245
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3246
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3247
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3248
%{
0
48194c26a46c Initial revision
claus
parents:
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;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3251
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
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(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3255
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3256
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3257
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3258
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3259
     && __bothSmallInteger(dstX, dstY)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3260
        gc = __GCVal(dstGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3261
        source = __DrawableVal(sourceId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3262
        dest =   __DrawableVal(destId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3263
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3264
        XCopyPlane(myDpy, source, dest, gc,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3265
                                 __intVal(srcX), __intVal(srcY),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3266
                                 __intVal(w), __intVal(h),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3267
                                 __intVal(dstX), __intVal(dstY), 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3268
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3269
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3270
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3271
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3272
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3273
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3274
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3275
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3276
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3277
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3278
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3279
    "do a bit-blt from a pix- or bitmap, but only copy the low-bit plane;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3280
     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
  3281
     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
  3282
     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
  3283
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3284
     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
  3285
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3286
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3287
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3288
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3289
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3290
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3291
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3292
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3293
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3294
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3295
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3296
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3297
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3298
     && __bothSmallInteger(dstX, dstY)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3299
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3300
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3301
        gc = __GCVal(dstGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3302
        source = __DrawableVal(sourceId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3303
        dest =   __DrawableVal(destId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3304
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3305
        XSetGraphicsExposures(dpy, gc, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3306
        XCopyPlane(dpy, source, dest, gc,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3307
                                 __intVal(srcX), __intVal(srcY),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3308
                                 __intVal(w), __intVal(h),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3309
                                 __intVal(dstX), __intVal(dstY), 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3310
        XSetGraphicsExposures(dpy, gc, 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3311
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3312
        RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3313
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3314
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3315
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3316
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3317
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3318
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3319
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3320
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3321
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
  3322
    "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
  3323
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3324
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3325
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3326
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3327
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3328
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3329
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3330
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3331
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3332
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3333
    if (__isSmallInteger(startAngle))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3334
        angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3335
    else if (__isFloat(startAngle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3336
        f = __floatVal(startAngle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3337
        angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3338
    } else if (__isShortFloat(startAngle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3339
        f = __shortFloatVal(startAngle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3340
        angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3341
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3342
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3343
    if (__isSmallInteger(angle))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3344
        angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3345
    else if (__isFloat(angle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3346
        f = __floatVal(angle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3347
        angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3348
    } else if (__isShortFloat(angle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3349
        f = __shortFloatVal(angle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3350
        angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3351
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3352
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3353
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3354
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3355
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3356
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3357
     && __bothSmallInteger(width, height)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3358
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3359
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3360
        w = __intVal(width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3361
        h = __intVal(height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3362
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3363
         * need this check here: some servers simply dump core with bad args
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3364
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3365
        if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3366
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3367
            XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3368
                                   w, h, angle1, angle2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3369
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3370
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3371
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3372
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3373
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3374
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3375
    "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
  3376
     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
  3377
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3378
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3379
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3380
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3381
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3382
    "draw a line. If the coordinates are not integers, an error is triggered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3383
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3384
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3385
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3386
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3387
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3388
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3389
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3390
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3391
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3392
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3393
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3394
     && __bothSmallInteger(x1, y1)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3395
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3396
        int ix0, iy0, ix1, iy1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3397
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3398
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3399
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3400
        ix0 = __intVal(x0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3401
        iy0 = __intVal(y0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3402
        ix1 = __intVal(x1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3403
        iy1 = __intVal(y1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3404
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3405
        /* attention: coordinates in X are shorts and wrap; clamp here. */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3406
        if (ix0 > 0x7FFF) ix0 = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3407
        else if (ix0 < -0x8000) ix0 = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3408
        if (iy0 > 0x7FFF) iy0 = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3409
        else if (iy0 < -0x8000) iy0 = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3410
        if (ix1 > 0x7FFF) ix1 = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3411
        else if (ix1 < -0x8000) ix1 = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3412
        if (iy1 > 0x7FFF) iy1 = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3413
        else if (iy1 < -0x8000) iy1 = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3414
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3415
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3416
        if ((ix0 == ix1) && (iy0 == iy1)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3417
            /* little bit shorter X-lib message (better with slow connections...) */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3418
            XDrawPoint(dpy, win, gc, ix0, iy0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3419
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3420
            XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3421
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3422
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3423
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3424
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3425
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3426
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3427
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3428
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3429
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3430
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
  3431
    "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
  3432
     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
  3433
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3434
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3435
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3436
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3437
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3438
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3439
    (noY := yValues size) < 2 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3440
        ^ self
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3441
    ].
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3442
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3443
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3444
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3445
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3446
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3447
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3448
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3449
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3450
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3451
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3452
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3453
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3454
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3455
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3456
     && __isExternalAddress(aDrawableId) ) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3457
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3458
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3459
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3460
        if( __isSmallInteger(scaleY) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3461
            sY = (float) __intVal( scaleY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3462
        else if (__isFloat(scaleY))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3463
            sY = __floatVal( scaleY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3464
        else if (__isShortFloat(scaleY))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3465
            sY = __shortFloatVal( scaleY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3466
        else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3467
            t = __SSEND0(scaleY, @symbol(asFloat), 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3468
            if (! __isFloat(t)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3469
            sY = __floatVal( t );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3470
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3471
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3472
        if( __isSmallInteger(transY) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3473
            tY = (float) __intVal( transY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3474
        else if (__isFloat(transY))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3475
            tY = __floatVal( transY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3476
        else if (__isShortFloat(transY))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3477
            tY = __shortFloatVal( transY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3478
        else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3479
            t = __SSEND0(transY, @symbol(asFloat), 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3480
            if (! __isFloat(t)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3481
            tY = __floatVal( t );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3482
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3483
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3484
        if( __isSmallInteger(startX) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3485
            x = (float) __intVal( startX );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3486
        else if (__isFloat(startX))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3487
            x = __floatVal( startX );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3488
        else if (__isShortFloat(startX))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3489
            x = __shortFloatVal( startX );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3490
        else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3491
            t = __SSEND0(startX, @symbol(asFloat), 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3492
            if (! __isFloat(t)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3493
            x = __floatVal( t );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3494
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3495
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3496
        if( __isSmallInteger(stepX) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3497
            step = (float) __intVal( stepX );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3498
        else if (__isFloat(stepX))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3499
            step = __floatVal( stepX );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3500
        else if (__isShortFloat(stepX))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3501
            step = __shortFloatVal( stepX );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3502
        else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3503
            t = __SSEND0(stepX, @symbol(asFloat), 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3504
            if (! __isFloat(t)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3505
            step = __floatVal( t );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3506
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3507
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3508
        num = __intVal( noY );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3509
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3510
        if( num > 200 ) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3511
            if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3512
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3513
            mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3514
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3515
            points = qPoints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3516
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3517
        for( i = 0; i < num; ++i ) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3518
            int px, py;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3519
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3520
            yA  = __AT_(yValues, __MKSMALLINT(i+1) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3521
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3522
            if( __isFloat(yA) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3523
                y = __floatVal( yA );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3524
            else if( __isSmallInteger(yA) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3525
                y = (float) __intVal( yA );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3526
            else if( __isShortFloat( yA) )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3527
                y = __shortFloatVal( yA );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3528
            else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3529
                t = __SSEND0(yA, @symbol(asFloat), 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3530
                if (! __isFloat(t)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3531
                y = __floatVal( t );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3532
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3533
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3534
            px = (int) (x + 0.5);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3535
            py = (int) ((y * sY) + tY + 0.5);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3536
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3537
            /* attention: coordinates in X are shorts and wrap; clamp here. */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3538
            if (px > 0x7FFF) px = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3539
            else if (px < -0x8000) px = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3540
            if (py > 0x7FFF) py = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3541
            else if (py < -0x8000) py = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3542
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3543
            points[i].x = px;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3544
            points[i].y = py;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3545
            x = x + step;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3546
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3547
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3548
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3549
        XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3550
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3551
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3552
        if( mustFree ) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3553
            free( points );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3554
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3555
        RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3556
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3557
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3558
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3559
    if( mustFree )
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3560
        free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3561
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3562
    ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3563
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3564
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3565
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3566
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3567
displayPointX:x y:y in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3568
    "draw a point. If x/y are not integers, an error is triggered."
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3569
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3570
    <context: #return>
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3571
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3572
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3573
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3574
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3575
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3576
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3577
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3578
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3579
     && __bothSmallInteger(x, y)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3580
        int px, py;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3581
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3582
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3583
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3584
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3585
        px = __intVal(x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3586
        py = __intVal(y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3587
        if (px > 0x7FFF) px = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3588
        else if (px < -0x8000) px = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3589
        if (py > 0x7FFF) py = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3590
        else if (py < -0x8000) py = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3591
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3592
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3593
        XDrawPoint(myDpy, win, gc, px, py);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3594
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3595
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3596
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3597
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3598
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3599
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3600
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3601
!
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
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3604
    "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
  3605
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3606
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3607
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3608
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3609
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3610
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3611
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3612
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3613
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3614
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3615
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3616
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3617
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3618
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3619
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3620
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3621
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3622
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3623
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3624
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3625
     && __isSmallInteger(numberOfPoints)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3626
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3627
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3628
        num = __intVal(numberOfPoints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3629
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3630
         * avoid a (slow) malloc, if the number of points is small
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3631
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3632
        if (num > 100) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3633
            points = (XPoint *)malloc(sizeof(XPoint) * num);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3634
            if (! points) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3635
            mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3636
        } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3637
            points = qPoints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3638
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3639
        for (i=0; i<num; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3640
            int px, py;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3641
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3642
            point = __AT_(aPolygon, __MKSMALLINT(i+1));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3643
            if (! __isPoint(point)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3644
            x = _point_X(point);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3645
            y = _point_Y(point);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3646
            if (! __bothSmallInteger(x, y))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3647
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3648
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3649
            px = __intVal(x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3650
            py = __intVal(y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3651
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3652
            /* attention: coordinates in X are shorts and wrap; clamp here. */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3653
            if (px > 0x7FFF) px = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3654
            else if (px < -0x8000) px = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3655
            if (py > 0x7FFF) py = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3656
            else if (py < -0x8000) py = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3657
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3658
            points[i].x = px;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3659
            points[i].y = py;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3660
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3661
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3662
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3663
        XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3664
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3665
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3666
        if (mustFree)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3667
            free(points);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3668
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3669
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3670
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3671
    if (mustFree)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3672
        free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3673
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3674
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3675
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3676
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3677
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3678
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3679
    "draw a rectangle. If the coordinates are not integers, an error is triggered."
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3680
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3681
    <context: #return>
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3682
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
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;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3686
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3687
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3688
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3689
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3690
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3691
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3692
     && __bothSmallInteger(width, height)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3693
        int px, py;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3694
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3695
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3696
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3697
        w = __intVal(width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3698
        h = __intVal(height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3699
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3700
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3701
         * need this check here: some servers simply dump core with bad args
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3702
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3703
        if ((w >= 0) && (h >= 0)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3704
            px = __intVal(x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3705
            py = __intVal(y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3706
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3707
            /* attention: coordinates in X are shorts and wrap; clamp here. */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3708
            if (px > 0x7FFF) px = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3709
            else if (px < -0x8000) px = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3710
            if (py > 0x7FFF) py = 0x7FFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3711
            else if (py < -0x8000) py = -0x8000;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3712
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3713
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3714
            XDrawRectangle(myDpy, win, gc, px, py, w, h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3715
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3716
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3717
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3718
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3719
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3720
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3721
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3722
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3723
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3724
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3725
    "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
  3726
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3727
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3728
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3729
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3730
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3731
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3732
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3733
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3734
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3735
    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
  3736
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3737
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3738
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3739
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3740
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3741
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3742
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3743
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3744
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3745
     && __bothSmallInteger(x, y)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3746
        int lMax = __intVal(@global(MaxStringLength));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3747
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3748
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3749
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3750
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3751
        i1 = __intVal(index1) - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3752
        if (i1 >= 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3753
            OBJ cls;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3754
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3755
            i2 = __intVal(index2) - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3756
            if (i2 < i1) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3757
                RETURN (self);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3758
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3759
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3760
            cp = (char *) __stringVal(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3761
            l = i2 - i1 + 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3762
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3763
            if (__isStringLike(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3764
                n = __stringSize(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3765
                if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3766
                    cp += i1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3767
                    if (l > lMax) l = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3768
                    ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3769
                    if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3770
                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3771
                    else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3772
                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3773
                    LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3774
                    RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3775
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3776
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3777
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3778
            cls = __qClass(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3779
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3780
            cp += nInstBytes;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3781
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3782
            if (__isBytes(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3783
                n = __byteArraySize(aString) - nInstBytes - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3784
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3785
                if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3786
                    cp += i1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3787
                    if (l > lMax) l = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3788
                    ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3789
                    if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3790
                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3791
                    else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3792
                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3793
                    LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3794
                    RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3795
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3796
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3797
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3798
            /* TWOBYTESTRINGS */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3799
            if (__isWords(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3800
                n = (__byteArraySize(aString) - nInstBytes) / 2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3801
                if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3802
                    union {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3803
                        char b[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3804
                        unsigned short s;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3805
                    } u;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3806
                    int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3807
                    XChar2b *cp2 = (XChar2b *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3808
                    int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3809
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3810
                    cp += (i1 * 2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3811
                    if (l > lMax) l = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3812
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3813
#if defined(MSBFIRST) || defined(__MSBFIRST)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3814
                    /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3815
                     * chars already in correct order
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3816
                     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3817
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3818
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3819
                    /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3820
                     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3821
                     * X expects them MSB first
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3822
                     * convert as required
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3823
                     */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3824
                    u.s = 0x1234;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3825
                    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3826
# endif
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3827
                    {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3828
                        if (l <= NLOCALBUFFER) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3829
                            cp2 = xlatebuffer;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3830
                        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3831
                            cp2 = (XChar2b *)(malloc(l * 2));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3832
                            mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3833
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3834
                        for (i=0; i<l; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3835
                            cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3836
                            cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3837
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3838
                        cp = (char *) cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3839
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3840
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3841
                    ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3842
                    if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3843
                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3844
                    else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3845
                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3846
                    LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3847
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3848
                    if (mustFree) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3849
                        free(cp2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3850
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3851
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3852
                    RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3853
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3854
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3855
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3856
            /* FOURBYTESTRINGS */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3857
            if (__isLongs(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3858
                n = (__byteArraySize(aString) - nInstBytes) / 4;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3859
                if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3860
                    union {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3861
                        char b[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3862
                        unsigned short s;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3863
                    } u;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3864
                    int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3865
                    XChar2b *cp2 = (XChar2b *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3866
                    int32 *ip;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3867
                    int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3868
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3869
                    cp += (i1 * 4);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3870
                    if (l > lMax) l = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3871
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3872
                    /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3873
                     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3874
                     */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3875
                    if (l <= NLOCALBUFFER) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3876
                        cp2 = xlatebuffer;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3877
                    } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3878
                        cp2 = (XChar2b *)(malloc(l * 2));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3879
                        mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3880
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3881
                    for (i=0; i<l; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3882
                        int32 codePoint = ((int32 *)cp)[i];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3883
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3884
                        if (codePoint > 0xFFFF) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3885
                            codePoint = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3886
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3887
                        cp2[i].byte1 = (codePoint >> 8) & 0xFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3888
                        cp2[i].byte2 = codePoint & 0xFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3889
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3890
                    cp = (char *) cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3891
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3892
                    ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3893
                    if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3894
                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3895
                    else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3896
                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3897
                    LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3898
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3899
                    if (mustFree) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3900
                        free(cp2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3901
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3902
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3903
                    RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3904
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3905
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3906
        }
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3907
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3908
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3909
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3910
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3911
        self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3912
             from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3913
        ^ self.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3914
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3915
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3916
    "x/y not integer, badGC or drawable, or not a string"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3917
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3918
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3919
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3920
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3921
    "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
  3922
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3923
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3924
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3925
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3926
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3927
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3928
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3929
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3930
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3931
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3932
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3933
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3934
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3935
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3936
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3937
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3938
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3939
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3940
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3941
     && __bothSmallInteger(x, y)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3942
        int lMax = __intVal(@global(MaxStringLength));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3943
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3944
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3945
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3946
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3947
        cp = (char *) __stringVal(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3948
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3949
        if (__isStringLike(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3950
            n = __stringSize(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3951
            if (n > lMax) n = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3952
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3953
            if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3954
                XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3955
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3956
                XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3957
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3958
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3959
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3960
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3961
        cls = __qClass(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3962
        nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3963
        cp += nInstBytes;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3964
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3965
        if (__isBytes(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3966
            n = __byteArraySize(aString) - nInstBytes - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3967
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3968
            if (n > lMax) n = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3969
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3970
            if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3971
                XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3972
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3973
                XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3974
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3975
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3976
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3977
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3978
        /* TWOBYTESTRINGS */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3979
        if (__isWords(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3980
            union {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3981
                char b[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3982
                unsigned short s;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3983
            } u;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3984
            int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3985
            XChar2b *cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3986
            int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3987
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3988
            n = (__byteArraySize(aString) - nInstBytes) / 2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3989
            if (n > lMax) n = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3990
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3991
#if defined(MSBFIRST) || defined(__MSBFIRST)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3992
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3993
             * chars already in correct order
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3994
             */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3995
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  3996
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3997
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3998
             * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  3999
             * X expects them MSB first
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4000
             * convert as required
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4001
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4002
            u.s = 0x1234;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4003
            if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4004
# endif
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4005
            {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4006
                if (n <= NLOCALBUFFER) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4007
                    cp2 = xlatebuffer;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4008
                } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4009
                    cp2 = (XChar2b *)(malloc(n * 2));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4010
                    mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4011
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4012
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4013
                for (i=0; i<n; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4014
                    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4015
                    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4016
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4017
                cp = (char *) cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4018
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4019
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4020
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4021
            if (opaque == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4022
                XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4023
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4024
                XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4025
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4026
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4027
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4028
            if (mustFree) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4029
                free(cp2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4030
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4031
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4032
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4033
        }
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4034
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4035
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4036
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4037
    ^ super displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4038
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4039
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4040
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4041
        width:imageWidth height:imageHeight
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4042
        x:srcx y:srcy
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4043
        into:aDrawableId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4044
        x:dstx y:dsty
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4045
        width:w height:h
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4046
        with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4047
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4048
    "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
  4049
     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
  4050
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4051
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4052
     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
  4053
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4054
     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
  4055
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4056
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4057
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4058
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4059
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4060
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4061
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4062
    "/ 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
  4063
    "/ 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
  4064
    "/ 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
  4065
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4066
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4067
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4068
        fmt := self supportedImageFormatForDepth:4.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4069
        fmt isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4070
            self primitiveFailed. "/ cannot represent this image
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4071
            ^ nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4072
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4073
        wantedPadding := fmt at:#padding.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4074
        wantedPadding > givenPadding ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4075
            bits := self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4076
                            repadBits:givenBits
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4077
                            width:imageWidth
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4078
                            height:imageHeight
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4079
                            depth:imageDepth
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4080
                            from:givenPadding
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4081
                            to:wantedPadding.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4082
            padding := wantedPadding.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4083
        ]
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4084
    ].
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4085
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4086
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4087
     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
  4088
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4089
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4090
    (self
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4091
        primDrawBits:bits
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4092
        bitsPerPixel:bitsPerPixel
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4093
        depth:imageDepth
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4094
        msb:true
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4095
        padding:padding
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4096
        width:imageWidth height:imageHeight
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4097
        x:srcx y:srcy
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4098
        into:aDrawableId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4099
        x:dstx y:dsty
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4100
        width:w height:h
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4101
        with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4102
    ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4103
        "
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4104
         also happens, if a segmentation violation occurs in the
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4105
         XPutImage ...
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4106
        "
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4107
        self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4108
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4109
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4110
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  4111
fillArcX:x y:y width:width height:height from:startAngle angle:angle
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4112
               in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4113
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4114
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4115
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4116
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4117
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4118
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4119
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4120
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4121
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4122
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4123
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4124
    if (__isSmallInteger(startAngle))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4125
        angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4126
    else if (__isFloat(startAngle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4127
        f = __floatVal(startAngle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4128
        angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4129
    } else if (__isShortFloat(startAngle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4130
        f = __shortFloatVal(startAngle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4131
        angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4132
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4133
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4134
    if (__isSmallInteger(angle))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4135
        angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4136
    else if (__isFloat(angle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4137
        f = __floatVal(angle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4138
        angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4139
    } else if (__isShortFloat(angle)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4140
        f = __shortFloatVal(angle);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4141
        angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4142
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4143
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4144
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4145
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4146
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4147
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4148
     && __bothSmallInteger(width, height)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4149
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4150
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4151
        w = __intVal(width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4152
        h = __intVal(height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4153
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4154
         * need this check here: some servers simply dump core with bad args
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4155
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4156
        if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4157
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4158
            XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4159
                                   w, h, angle1, angle2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4160
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4161
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4162
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4163
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4164
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4165
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4166
    "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
  4167
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4168
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4169
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4170
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4171
48194c26a46c Initial revision
claus
parents:
diff changeset
  4172
fillPolygon:aPolygon in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4173
    "fill a polygon given by its points.
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4174
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4175
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4176
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4177
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4178
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4179
48194c26a46c Initial revision
claus
parents:
diff changeset
  4180
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  4181
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4182
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4183
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4184
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4185
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4186
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4187
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4188
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4189
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4190
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4191
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4192
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4193
     && __isSmallInteger(numberOfPoints)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4194
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4195
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4196
        num = __intVal(numberOfPoints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4197
        if (num < 3) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4198
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4199
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4200
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4201
         * avoid (slow) malloc, if not many points
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4202
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4203
        if (num > 100) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4204
            points = (XPoint *) malloc(sizeof(XPoint) * num);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4205
            if (! points) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4206
            mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4207
        } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4208
            points = qPoints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4209
        for (i=0; i<num; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4210
            point = __AT_(aPolygon, __MKSMALLINT(i+1));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4211
            if (! __isPoint(point)) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4212
            x = _point_X(point);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4213
            y = _point_Y(point);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4214
            if (! __bothSmallInteger(x, y))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4215
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4216
            points[i].x = __intVal(x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4217
            points[i].y = __intVal(y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4218
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4219
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4220
        XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4221
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4222
        if (mustFree)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4223
            free(points);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4224
        RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4225
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4226
fail: ;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4227
        if (mustFree)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4228
            free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4229
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4230
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4231
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4232
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4233
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4234
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4235
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
  4236
    "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
  4237
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4238
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4239
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4240
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4241
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4242
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4243
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4244
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4245
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4246
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4247
     && __bothSmallInteger(width, height)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4248
        w = __intVal(width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4249
        h = __intVal(height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4250
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4251
         * need this check here: some servers simply dump core with bad args
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4252
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4253
        if ((w >= 0) && (h >= 0)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4254
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4255
            XFillRectangle(myDpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4256
                           __DrawableVal(aDrawableId), __GCVal(aGCId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4257
                           __intVal(x), __intVal(y), w, h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4258
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4259
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4260
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4261
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4262
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4263
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4264
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4265
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4266
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4267
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4268
                             extent:imageExtent sourceOrigin:srcOrg
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4269
                               into:aDrawableId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4270
                  destinationOrigin:dstOrg extent:dstExtent
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4271
                               with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4272
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4273
    <context: #return>
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4274
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4275
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4276
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4277
    imageWidth := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4278
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4279
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4280
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4281
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4282
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4283
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4284
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4285
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4286
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4287
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4288
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4289
    "since XPutImage may allocate huge amount of stack space
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4290
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4291
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4292
%{  /* UNLIMITEDSTACK */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4293
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4294
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4295
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4296
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4297
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4298
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4299
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4300
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4301
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4302
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4303
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4304
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4305
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4306
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4307
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4308
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4309
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4310
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4311
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4312
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4313
     && __isSmallInteger(bm)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4314
     && __isByteArrayLike(imageBits)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4315
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4316
        int pad = __intVal(bitPadding);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4317
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4318
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4319
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4320
        if (! gc || !win)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4321
            goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4322
#ifdef ARGDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4323
        console_printf("args ok\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4324
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4325
        image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4326
        image.width = imgWdth = __intVal(imageWidth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4327
        image.height = __intVal(imageHeight);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4328
        image.xoffset = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4329
        image.format = ZPixmap;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4330
        image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4331
        image.bitmap_unit = 8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4332
        image.bitmap_bit_order = MSBFirst;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4333
        image.bitmap_pad = pad;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4334
        image.depth = __intVal(imageDepth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4335
        image.bits_per_pixel = __intVal(bitsPerPixel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4336
        image.red_mask = __intVal(rm);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4337
        image.green_mask = __intVal(gm);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4338
        image.blue_mask = __intVal(bm);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4339
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4340
        image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4341
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4342
        switch (image.bits_per_pixel) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4343
            case 1:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4344
            case 2:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4345
            case 4:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4346
            case 8:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4347
            case 16:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4348
            case 24:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4349
            case 32:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4350
                break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4351
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4352
            default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4353
#ifdef ARGDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4354
                console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4355
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4356
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4357
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4358
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4359
        /* ENTER_XLIB(); */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4360
        XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4361
                                        __intVal(dstx), __intVal(dsty),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4362
                                        __intVal(w), __intVal(h));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4363
        /* LEAVE_XLIB(); */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4364
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4365
        RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4366
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4367
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4368
    if (!! __isExternalAddress(aGCId)) console_printf("GC\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4369
    if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4370
    if (!! __isSmallInteger(srcx)) console_printf("srcx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4371
    if (!! __isSmallInteger(srcy)) console_printf("srcy\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4372
    if (!! __isSmallInteger(dstx)) console_printf("dstx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4373
    if (!! __isSmallInteger(dsty)) console_printf("dsty\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4374
    if (!! __isSmallInteger(w)) console_printf("w\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4375
    if (!! __isSmallInteger(h)) console_printf("h\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4376
    if (!! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4377
    if (!! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4378
    if (!! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4379
    if (!! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4380
    if (!! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4381
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4382
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4383
fail: ;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4384
%}
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4385
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4386
    ^ false
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4387
!
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4388
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  4389
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4390
                              width:imageWidth height:imageHeight
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4391
                                  x:srcx y:srcy
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4392
                               into:aDrawableId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4393
                                  x:dstx y:dsty
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4394
                              width:w height:h
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4395
                               with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4396
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4397
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4398
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4399
    "since XPutImage may allocate huge amount of stack space
132
claus
parents: 129
diff changeset
  4400
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  4401
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4402
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4403
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4404
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4405
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4406
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4407
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4408
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4409
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4410
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4411
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4412
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4413
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4414
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4415
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4416
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4417
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4418
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4419
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4420
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  4421
     && __isSmallInteger(bitPadding)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4422
     && __isByteArrayLike(imageBits)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4423
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4424
        int pad = __intVal(bitPadding);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4425
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4426
        gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4427
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4428
        if (! gc || !win)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4429
            goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4430
#ifdef ARGDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4431
        console_printf("args ok\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4432
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4433
        image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4434
        image.width = imgWdth = __intVal(imageWidth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4435
        image.height = __intVal(imageHeight);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4436
        image.xoffset = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4437
        image.format = ZPixmap;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4438
        image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4439
        image.bitmap_unit = 8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4440
        image.bitmap_bit_order = MSBFirst;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4441
        image.bitmap_pad = pad;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4442
        image.depth = __intVal(imageDepth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4443
        image.bits_per_pixel = __intVal(bitsPerPixel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4444
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4445
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4446
        image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4447
        */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4448
        image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4449
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4450
        switch (image.bits_per_pixel) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4451
            case 1:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4452
            case 2:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4453
            case 4:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4454
            case 8:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4455
            case 16:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4456
            case 24:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4457
            case 32:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4458
                break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4459
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4460
            default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4461
#ifdef ARGDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4462
                console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4463
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4464
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4465
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4466
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4467
        image.red_mask = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4468
        image.green_mask = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4469
        image.blue_mask = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4470
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4471
        /* ENTER_XLIB(); */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4472
        XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4473
                                        __intVal(dstx), __intVal(dsty),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4474
                                        __intVal(w), __intVal(h));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4475
        /* LEAVE_XLIB(); */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4476
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4477
        RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4478
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4479
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4480
    if (!! __isExternalAddress(aGCId)) console_printf("GC\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4481
    if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4482
    if (!! __isSmallInteger(srcx)) console_printf("srcx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4483
    if (!! __isSmallInteger(srcy)) console_printf("srcy\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4484
    if (!! __isSmallInteger(dstx)) console_printf("dstx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4485
    if (!! __isSmallInteger(dsty)) console_printf("dsty\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4486
    if (!! __isSmallInteger(w)) console_printf("w\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4487
    if (!! __isSmallInteger(h)) console_printf("h\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4488
    if (!! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4489
    if (!! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4490
    if (!! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  4491
    if (!! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4492
    if (!! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4493
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  4494
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4495
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4496
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  4497
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4498
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4499
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  4500
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4501
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4502
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4503
buttonMotion:view state:state x:x y:y rootX:rX rootY:rY time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4504
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4505
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4506
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4507
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4508
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4509
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4510
buttonPress:view button:button state:state x:x y:y rootX:rX rootY:rY time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4511
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4512
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4513
    |logicalButton|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4514
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4515
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4516
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4517
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4518
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4519
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4520
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4521
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4522
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4523
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4524
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4525
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  4526
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  4527
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  4528
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4529
      self mouseWheelMotion:state x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4530
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4531
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4532
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4533
    logicalButton isInteger ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4534
        buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4535
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4536
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4537
    (multiClickTimeDelta notNil and:[lastButtonPressTime notNil]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4538
        time < (lastButtonPressTime + multiClickTimeDelta) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4539
            lastButtonPressTime := time.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4540
            self buttonMultiPress:logicalButton x:x y:y view:view.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4541
            ^ self.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4542
        ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4543
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4544
    lastButtonPressTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4545
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4546
    view isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4547
        "/ event arrived, after I destroyed it myself
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4548
        ^ self
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4549
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4550
    logicalButton == 1 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4551
        activateOnClick == true ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4552
            "/ dont raise above an active popup view.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4553
            (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4554
                view topView raise.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4555
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4556
        ].
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4557
    ].
3330
85fa3a6ce50d *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3329
diff changeset
  4558
    super buttonPress:logicalButton x:x y:y view:view
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4559
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4560
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4561
buttonRelease:view button:button state:state x:x y:y rootX:rX rootY:rY time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4562
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4563
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4564
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4565
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4566
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4567
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4568
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4569
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4570
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4571
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4572
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4573
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4574
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4575
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4576
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4577
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4578
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4579
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4580
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4581
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4582
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4583
    logicalButton isInteger ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4584
        buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  4585
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4586
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4587
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4588
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4589
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4590
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4591
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  4592
    targetView isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4593
        "targetView is gone? Anyway, cannot do anything with this event..."
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4594
        ^ self.
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  4595
    ].
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  4596
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4597
    "DND drag&drop protocol"
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4598
    (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4599
        self dndMessage:nil data:data view:targetView.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4600
        ^ self.
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4601
    ].
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4602
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4603
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4604
    "not posted, if there is no sensor ..."
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4605
    sensor notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4606
        sensor clientMessage:typeAtom format:format eventData:data view:targetView
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4607
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4608
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4609
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4610
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4611
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4612
configure:view x:x y:y width:w height:h above:above
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4613
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4614
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4615
    self configureX:x y:y width:w height:h view:view.
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4616
    above notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4617
        |aboveView|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4618
        aboveView := self viewFromId:above.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4619
        aboveView notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4620
            "view is now on the top of the window stack"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4621
            self coveredBy:view view:aboveView.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4622
        ].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  4623
     ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4624
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4625
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4626
createWindow:view x:x y:y width:w height:h
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4627
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4628
    view isNil ifTrue:[
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4629
        "/ event arrived, after I destroyed it myself
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4630
        ^ self
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4631
    ].
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4632
    view sensor createWindow:view x:x y:y width:w height:h
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4633
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4634
    "Created: / 30-05-2011 / 16:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4635
    "Modified: / 30-05-2011 / 19:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4636
!
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4637
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4638
dndMessage:event data:data view:targetView
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4639
    "handle a drag&drop protocol message"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4640
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4641
    |sensor property dropType dropValue names i1 i2 propertyType|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4642
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4643
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4644
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4645
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  4646
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4647
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4648
    property := self
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4649
        getProperty:(self atomIDOf:#DndSelection)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4650
        from:rootId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4651
        delete:false.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4652
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4653
    propertyType := property key.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4654
    dropValue := property value.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4655
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4656
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4657
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4658
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4659
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4660
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4661
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4662
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4663
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4664
    dropType == #DndFiles ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4665
        "/ actually, a list of fileNames
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4666
        propertyType ~~ stringAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4667
            'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4668
            ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4669
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4670
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4671
        names := OrderedCollection new.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4672
        i1 := 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4673
        [i1 ~~ 0] whileTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4674
            i2 := dropValue indexOf:(Character value:0) startingAt:i1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4675
            i2 ~~ 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4676
                names add:(dropValue copyFrom:i1 to:(i2-1)).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4677
                i1 := i2 + 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4678
            ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4679
                i1 := i2
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4680
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4681
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4682
        dropValue := names.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4683
        dropValue := dropValue collect:[:nm | nm asFilename].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4684
        dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4685
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4686
        propertyType ~~ stringAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4687
            'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4688
            ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4689
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4690
        dropValue := dropValue asFilename.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4691
        dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4692
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4693
        propertyType ~~ stringAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4694
            'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4695
            ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4696
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4697
        dropValue := dropValue asFilename.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4698
        dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4699
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4700
        propertyType ~~ stringAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4701
            'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4702
            ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4703
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4704
        dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4705
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4706
        propertyType ~~ stringAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4707
            'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4708
            ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4709
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4710
        dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4711
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4712
        propertyType ~~ stringAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4713
            'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4714
            ^ self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4715
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4716
        dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4717
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4718
        dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  4719
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4720
        'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4721
        'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4722
        dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4723
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4724
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4725
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4726
    "not posted, if there is no sensor ..."
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4727
    sensor notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4728
        sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  4729
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4730
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4731
    "Created: 4.4.1997 / 17:59:37 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4732
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4733
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4734
expose:view x:x y:y width:w height:h count:count
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4735
    "forward an expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4736
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4737
    self exposeX:x y:y width:w height:h view:view.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4738
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4739
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4740
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4741
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4742
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4743
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4744
focusIn:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4745
    "a view got the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4746
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4747
    mode ~~ 1 "NotifyGrab" ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4748
        "mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4749
        self focusInView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4750
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4751
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4752
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4753
focusOut:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4754
    "a view lost the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4755
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4756
    mode ~~ 1 "NotifyGrab" ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4757
        "mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4758
        self focusOutView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  4759
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4760
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4761
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4762
graphicsExpose:view x:x y:y width:w height:h count:count
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4763
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4764
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4765
    self graphicsExposeX:x y:y width:w height:h final:(count==0) view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4766
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4767
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4768
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4769
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4770
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4771
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4772
keyPress:view key:key code:keyCode state:state x:x y:y rootX:rX rootY:rY time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4773
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4774
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4775
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4776
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4777
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4778
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4779
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4780
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4781
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4782
    key isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4783
        "/ happens sometimes on some systems
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4784
        "/ (alt-graph on sun has no keysym)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4785
        ^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4786
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4787
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4788
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4789
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4790
    "very low-level mapping of X11 event symbols to common ST/X event symbols"
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4791
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4792
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4793
    self keyPress:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4794
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4795
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4796
keyRelease:view key:key code:keyCode state:state x:x y:y rootX:rX rootY:rY time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4797
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4798
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4799
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4800
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4801
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4802
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4803
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4804
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4805
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4806
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4807
    key isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4808
        "/ happens sometimes on some systems
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4809
        "/ (alt-graph on sun has no keysym)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4810
        ^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4811
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4812
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4813
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4814
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4815
    "very low-level mapping of X11 event symbols to common ST/X event symbols"
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4816
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4817
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  4818
    self keyRelease:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4819
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4820
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4821
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4822
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4823
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4824
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4825
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4826
        self refreshKeyboardMapping:eB.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4827
        "Maybe some of our modifiers have been changed"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4828
        self initializeModifierMappings.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4829
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  4830
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4831
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4832
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4833
pointerEnter:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4834
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4835
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4836
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4837
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4838
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4839
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4840
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4841
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4842
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4843
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4844
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4845
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4846
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4847
pointerLeave:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4848
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4849
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4850
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4851
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4852
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4853
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4854
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4855
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4856
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4857
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4858
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4859
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4860
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4861
propertyChange:aView property:propertyId state:aSymbol time:time
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4862
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4863
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4864
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4865
    |selectionFetcher|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4866
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4867
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  4868
    aView isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4869
        "event arrived, after aView has been destroyed"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4870
        ^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4871
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4872
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4873
"/    'propertyChange ' infoPrint. (self atomName:propertyId) print. ': ' print. aSymbol printCR.
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4874
"/    aView propertyChange:atom state:aSymbol.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4875
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4876
    "JV@2011-01-06: Forward this event to views, they may
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4877
     be interested (for now, only XEmbedSiteView is)"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4878
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4879
    aView sensor propertyChange:aView property:propertyId state:aSymbol time:time.
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4880
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4881
    aSymbol ~~ #newValue ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4882
        "I am not interested in delete notifications"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4883
        ^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4884
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4885
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4886
    selectionFetcher notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4887
        selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4888
    ].
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4889
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  4890
    "Modified: / 01-06-2011 / 13:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4891
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4892
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4893
selectionClear:aView selection:selectionID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4894
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4895
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4896
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4897
    lastEventTime := time.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4898
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4899
    selectionHandlers notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4900
        selectionHandlers do:[:eachHandler |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4901
            eachHandler selectionClear:selectionID
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4902
        ]
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  4903
    ].
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4904
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4905
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  4906
selectionNotify:aView selection:selectionID target:targetID property:propertyID requestor:requestorID time:time
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4907
    "This event is sent by the selection owner as a response to our request for a selection.
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4908
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4909
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4910
    |selectionFetcher|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4911
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4912
"/    Transcript show:'seletionNotify selID:'.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4913
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4914
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4915
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4916
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4917
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4918
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4919
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  4920
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4921
    lastEventTime := time.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4922
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4923
    aView isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4924
        "event arrived, after aView has been destroyed"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4925
        ^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4926
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4927
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4928
    selectionFetcher notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4929
        selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4930
    ].
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4931
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4932
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4933
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4934
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4935
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4936
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4937
    |selection property|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4938
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4939
"/'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4940
"/'Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4941
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4942
    lastEventTime := time.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4943
    "JV@2012-03-27: Support both PRIMARY and CLIPBOARD selections"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4944
    selectionID == primaryAtom ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4945
        selection := self primaryBufferAs:targetID.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4946
    ] ifFalse:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4947
        selection := self copyBufferAs:targetID.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4948
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4949
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4950
"/'Send selection: ' print. selection printCR.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4951
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4952
    property := propertyID.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4953
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4954
    selection isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4955
        "sending property None tells the client,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4956
         that I could not convert"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  4957
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4958
        property := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4959
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4960
        property == 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4961
            "Support old (obsolete) clients requesting a None property.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4962
             Set the propertyID to the targetID"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4963
            property := targetID.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4964
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4965
        self setProperty:property
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4966
             type:targetID
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4967
             value:selection
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4968
             for:requestorID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4969
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  4970
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  4971
    self sendNotifySelection:selectionID
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4972
         property:property
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4973
         target:targetID
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4974
         time:time
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4975
         to:requestorID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4976
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  4977
    "Modified: / 27-03-2012 / 15:22:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4978
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  4979
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4980
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4981
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4982
    aView notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4983
        aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  4984
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4985
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4986
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  4987
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4988
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4989
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4990
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4991
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4992
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4993
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4994
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4995
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4996
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4997
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4998
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  4999
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5000
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5001
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5002
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5003
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5004
    aView isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5005
        "/ event arrived, after I destroyed it myself
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5006
        ^ self
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5007
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5008
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5009
    "/ aView colorMapChange
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5010
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5011
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5012
configureRequest:view x:x y:y width:w height:h above:above detail:detail
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5013
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5014
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5015
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5016
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5017
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5018
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5019
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5020
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5021
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5022
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5023
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5024
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5025
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5026
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5027
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5028
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5029
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5030
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5031
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5032
    "/ aView mapRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5033
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5034
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5035
reparentedView:aView parentId:parentId x:x y:y
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5036
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5037
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5038
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5039
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5040
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5041
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5042
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5043
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5044
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5045
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5046
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  5047
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5048
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5049
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5050
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5051
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5052
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5053
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5054
                         KeyPressMask | KeyReleaseMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5055
                         PointerMotionMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5056
                         EnterWindowMask | LeaveWindowMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5057
                         ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5058
                         PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5059
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5060
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5061
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5062
dispatchEvent:evArray
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5063
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5064
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5065
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5066
    viewId notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5067
        viewId = lastId ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5068
            view := lastView
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5069
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5070
            view := self viewFromId:viewId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5071
        ].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5072
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5073
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5074
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5075
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5076
    (self respondsTo:evType) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5077
        arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5078
        arguments at:1 put:view.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5079
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5080
        self perform:evType withArguments:arguments.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5081
        ^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5082
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5083
'********** unhandled event:' errorPrintCR.
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5084
evType errorPrintCR. (evArray at:2) errorPrintCR.
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5085
'********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5086
    ^ false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5087
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5088
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5089
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5090
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5091
     get next event and send appropriate message to the sensor or view.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5092
     If the argument aViewIdOrNil is nil, events for any view are processed,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5093
     otherwise only events for the view with given id are processed.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5094
     If the argument aMask is nonNil, only events for this eventMask are
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5095
     handled.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5096
     WARNING: this may block to wait for an event - you better check for a
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5097
              pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5098
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5099
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5100
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5101
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5102
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5103
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5104
        AbortOperationRequest handle:[:ex |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5105
            ex return
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5106
        ] do:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5107
            self dispatchEvent:eventArray.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5108
        ]
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5109
    ].
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5110
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5111
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5112
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5113
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5114
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5115
    "get next expose event and send appropriate message to the sensor or view.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5116
     If the argument aViewIdOrNil is nil, events for any view are processed,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5117
     otherwise only events for the view with given id are processed.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5118
     WARNING: this may block to wait for an event - you better check for a
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5119
              pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5120
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5121
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5122
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5123
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5124
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5125
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5126
dispatchLoop
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5127
    preWaitAction := [self flush].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5128
    Processor addPreWaitAction:preWaitAction.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5129
    [
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5130
        super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  5131
    ] ensure:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5132
        Processor removePreWaitAction:preWaitAction.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5133
        preWaitAction := nil.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5134
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5135
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5136
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5137
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5138
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5139
     (i.e. this is now only used in the modal debugger)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5140
     Dispatch any pending events; return when no more are pending.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5141
     This code is somewhat special, since X has a concept of graphic
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5142
     expose events (which are sent after a bitblt). After such a bitblt,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5143
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5144
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5145
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5146
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5147
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5148
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5149
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5150
    dispatchingExpose notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5151
        [self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5152
            self dispatchExposeEventFor:dispatchingExpose
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5153
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5154
        ^ self
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5155
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5156
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5157
    eventArray := Array new:13.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5158
    [self eventPendingWithSync:false] whileTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5159
        (self getEventFor:nil withMask:nil into:eventArray) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5160
            AbortOperationRequest handle:[:ex |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5161
                ex return
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5162
            ] do:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5163
                self dispatchEvent:eventArray.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5164
                "/ multi-screen config: give others a chance
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5165
                "/ (needed because we run at high (non-timesliced) prio)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5166
                Processor yield.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5167
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5168
        ].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5169
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5170
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5171
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5172
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5173
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5174
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5175
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5176
     events matching the mask are thrown away regardless of which
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5177
     view they are for. Otherwise, only matching events for that
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5178
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5179
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5180
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  5181
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5182
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5183
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5184
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5185
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5186
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5187
     && __isSmallInteger(aMask)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5188
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5189
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5190
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5191
        if (__isExternalAddress(aWindowIdOrNil)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5192
            win = __WindowVal(aWindowIdOrNil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5193
            while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5194
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5195
            while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5196
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5197
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5198
        RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5199
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5200
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5201
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5202
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5203
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5204
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5205
    "return the eventMask bit-constant corresponding to an event symbol"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5206
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5207
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5208
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5209
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5210
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5211
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5212
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5213
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5214
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5215
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5216
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5217
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5218
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5219
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5220
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5221
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5222
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5223
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5224
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5225
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5226
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5227
    else if (anEventSymbol == @symbol(substructureNotify)) m = SubstructureNotifyMask;
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5228
    else if (anEventSymbol == @symbol(substructureRedirect)) m = SubstructureRedirectMask;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5229
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5230
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5231
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5232
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5233
eventPending
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5234
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5235
     This looks for both the internal queue and the display connection."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5236
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5237
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5238
    "/ where eventPending returns wrong if we do not flush the buffer.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5239
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5240
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5241
    ConservativeSync == true ifTrue:[self sync].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5242
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5243
    dispatchingExpose notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5244
        ^ self exposeEventPendingFor:dispatchingExpose withSync:false
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5245
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5246
    ^ self eventPendingWithSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5247
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5248
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5249
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5250
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5251
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5252
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5253
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5254
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5255
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5256
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5257
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5258
    "return true, if any of the masked events is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5259
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5260
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5261
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5262
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5263
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5264
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5265
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5266
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5267
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5268
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5269
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5270
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5271
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5272
        if (doSync == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5273
            XSync(dpy, 0);      /* make certain everything is flushed */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5274
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5275
        if (__isExternalAddress(aWindowIdOrNil)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5276
            win = __WindowVal(aWindowIdOrNil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5277
            thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5278
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5279
            thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5280
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5281
        if (thereIsOne) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5282
            XPutBackEvent(dpy, &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5283
            rslt = true;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5284
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5285
        LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5286
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5287
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5288
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5289
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5290
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5291
eventPendingWithSync:doSync
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5292
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5293
     If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5294
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5295
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5296
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5297
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5298
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5299
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5300
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5301
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5302
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5303
        if (XEventsQueued(dpy, QueuedAlready)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5304
            RETURN (true);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5305
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5306
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5307
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5308
        if (doSync == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5309
            XSync(dpy, 0);      /* make certain everything is flushed */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5310
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5311
        if (XPending(dpy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5312
            rslt = true;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5313
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5314
        LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5315
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5316
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5317
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5318
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5320
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5321
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5322
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5323
    dispatchingExpose notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5324
        ^ self exposeEventPendingFor:dispatchingExpose withSync:false
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5325
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5326
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5327
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5328
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5329
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5330
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5331
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5332
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5333
     (i.e. in X's internal event queue, which is both filled by explicit
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5334
      nextEvent calls AND whenever drawing is done and events are pending on
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5335
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5336
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5337
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5338
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5339
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5340
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5341
        /* ENTER ... LEAVE not needed; XEventsQueued will not block */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5342
        /* ENTER_XLIB(); */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5343
        if (XEventsQueued(myDpy, QueuedAlready)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5344
            rslt = true;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5345
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5346
        /* LEAVE_XLIB(); */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5347
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5348
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5349
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5350
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5351
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5352
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5353
    "return true, if any expose event is pending for a specific view,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5354
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5355
     This is an X specific, only required after a scroll operation."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5356
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5357
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5358
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5359
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5360
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5361
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5362
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5363
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5364
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5365
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5366
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5367
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5368
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5369
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5370
        if (doSync == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5371
            XSync(dpy, 0);      /* make certain everything is flushed */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5372
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5373
        if (__isExternalAddress(aWindowIdOrNil)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5374
            win = __WindowVal(aWindowIdOrNil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5375
            thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5376
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5377
            thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5378
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5379
        if (thereIsOne) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5380
            XPutBackEvent(dpy, &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5381
            rslt = true;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5382
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5383
        LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5384
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5385
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5386
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5387
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5388
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5389
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5390
    "read next event if there is one and put events data into anEventArray.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5391
     If aViewIdOrNil is nil, events for any view are fetched;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5392
     otherwise only events for that specific view will be fetched.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5393
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5394
     This method may block - so you better check for pending events
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5395
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5396
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5397
     The event fields are placed them into anEventArray (must be at least size 13):
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5398
     the fields are:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5399
        1:      windowID
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5400
        2:      eventType-ID
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5401
        3:      eventTypeSymbol
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5402
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5403
        4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5404
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5405
     Sorry I had to split dispatch into this fetch method and a separate
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5406
     handler method to allow UNLIMITEDSTACK here.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5407
     (some Xlibs do a big alloca there which cannot be done in
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  5408
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5409
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5410
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5411
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5412
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5413
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5414
    Window win, wWanted;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5415
    int evMask, returnValue;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5416
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5417
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5418
    KeySym keySym;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5419
    unsigned char buffer[10];
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5420
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5421
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5422
    char keySymStringBuffer[32];
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5423
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5424
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5425
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5426
        RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5427
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5428
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5429
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5430
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5431
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5432
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5433
    if (__isSmallInteger(eventMask)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5434
        evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5435
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5436
        evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5437
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5438
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5439
    if (__isExternalAddress(aViewIdOrNil)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5440
        wWanted = __WindowVal(aViewIdOrNil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5441
        returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5442
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5443
        if (evMask == ~0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5444
            XNextEvent(dpy, &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5445
            returnValue = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5446
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5447
            returnValue = XCheckMaskEvent(dpy, evMask, &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5448
        }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5449
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5450
    if (!returnValue) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5451
        /* there is no event */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5452
        RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5453
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5454
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5455
    if (anEventArray == nil) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5456
        /* sender is not interested in the event */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5457
        RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5458
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5459
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5460
    if (!__isArray(anEventArray)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5461
        console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5462
        RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5463
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5464
    if (__arraySize(anEventArray) < 11) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5465
        console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5466
        RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5467
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5468
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5469
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5470
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5471
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5472
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5473
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5474
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5475
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5476
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5477
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5478
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5479
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5480
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5481
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5482
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5483
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5484
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5485
#   define rr ((XResizeRequestEvent *)&ev)
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5486
#   define rpe ((XReparentEvent *)&ev)
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5487
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5488
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5489
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5490
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5491
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5492
    if (((t = __INST(lastId)) != nil)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5493
         && __isExternalAddress(t)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5494
         && (__WindowVal(t) == ae->window)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5495
        windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5496
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5497
        windowID = __MKEXTERNALADDRESS(ae->window);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5498
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5499
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5500
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5501
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5502
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5503
    switch (ev.type) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5504
        case KeyRelease:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5505
            sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5506
            goto keyPressAndRelease;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5507
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5508
        case KeyPress:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5509
            sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5510
            /* FALL INTO */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5511
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5512
        keyPressAndRelease:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5513
            arg = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5514
            nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5515
            if (nchars
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5516
             && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5517
                 || (buffer[0] >= 0x80))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5518
                arg = __MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5519
                keySymString = NULL;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5520
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5521
                keySymString = XKeysymToString(keySym);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5522
                if (keySymString) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5523
                    arg = __MKSYMBOL(keySymString, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5524
                } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5525
                    arg = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5526
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5527
            }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5528
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5529
#ifdef IGNORE_UNKNOWN_KEYCODES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5530
            if (arg == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5531
                /* happens sometimes (alt-graph on sun has no keysym) */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5532
                RETURN (false);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5533
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5534
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5535
            __ArrayInstPtr(anEventArray)->a_element[2] = sym;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5536
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5537
            __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5538
            t = __MKUINT(ke->keycode); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5539
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5540
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5541
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5542
            __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5543
            __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5544
            t = __MKUINT(ke->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5545
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5546
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5547
        case ButtonPress:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5548
            sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5549
            goto buttonPressAndRelease;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5550
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5551
        case ButtonRelease:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5552
            sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5553
            /* fall into */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5554
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5555
        buttonPressAndRelease:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5556
            __ArrayInstPtr(anEventArray)->a_element[2] = sym;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5557
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5558
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5559
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5560
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5561
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5562
            __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5563
            t = __MKUINT(be->time); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5564
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5565
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5566
        case MotionNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5567
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5568
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5569
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5570
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5571
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5572
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5573
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5574
            t = __MKUINT(me->time); __ArrayInstPtr(anEventArray)->a_element[8] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5575
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5576
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5577
        case FocusIn:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5578
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5579
            goto focusInOut;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5580
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5581
        case FocusOut:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5582
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5583
            /* fall into */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5584
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5585
        focusInOut:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5586
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5587
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5588
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5589
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5590
        case EnterNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5591
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5592
            goto enterLeave;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5593
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5594
        case LeaveNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5595
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5596
            /* fall into */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5597
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5598
        enterLeave:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5599
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5600
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5601
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5602
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5603
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5604
            __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5605
            __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5606
            t = __MKUINT(ele->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5607
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5608
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5609
        case Expose:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5610
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5611
            goto expose;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5612
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5613
        case GraphicsExpose:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5614
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5615
            /* fall into */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5616
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5617
        expose:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5618
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5619
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5620
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5621
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5622
            __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5623
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5624
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5625
        case NoExpose:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5626
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5627
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5628
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5629
        case VisibilityNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5630
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5631
            switch (ve->state) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5632
                case VisibilityUnobscured:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5633
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5634
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5635
                case VisibilityPartiallyObscured:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5636
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5637
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5638
                case VisibilityFullyObscured:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5639
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5640
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5641
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5642
                    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5643
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5644
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5645
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5646
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5647
        case CreateNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5648
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5649
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5650
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5651
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5652
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5653
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5654
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5655
        case DestroyNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5656
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5657
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5658
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5659
        case UnmapNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5660
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5661
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5662
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5663
        case MapNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5664
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5665
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5666
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5667
        case ConfigureNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5668
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:x:y:width:height:above:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5669
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ce->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5670
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5671
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5672
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5673
            __ArrayInstPtr(anEventArray)->a_element[7] = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5674
            if (ce->above != None) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5675
                t = __MKEXTERNALADDRESS(ce->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5676
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5677
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5678
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5679
        case GravityNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5680
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5681
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5682
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5683
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5684
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5685
        case ResizeRequest:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5686
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5687
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5688
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5689
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5690
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5691
        case ConfigureRequest:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5692
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5693
            __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5694
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5695
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5696
            __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5697
            __ArrayInstPtr(anEventArray)->a_element[7] = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5698
            if (cr->above != None) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5699
                t = __MKEXTERNALADDRESS(cr->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5700
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5701
            switch (cr->detail) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5702
                case Above:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5703
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5704
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5705
                case Below:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5706
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5707
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5708
                case TopIf:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5709
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5710
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5711
                case BottomIf:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5712
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5713
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5714
                case Opposite:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5715
                    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5716
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5717
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5718
                    __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5719
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5720
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5721
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5722
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5723
        case CirculateNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5724
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5725
            goto circulate;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5726
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5727
        case CirculateRequest:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5728
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5729
            /* fall into */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5730
        circulate:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5731
            switch (cie->place) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5732
                case PlaceOnTop:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5733
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5734
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5735
                case PlaceOnBottom:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5736
                    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5737
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5738
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5739
                    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5740
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5741
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5742
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5743
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5744
        case PropertyNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5745
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5746
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5747
            switch (pe->state) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5748
                case PropertyNewValue:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5749
                    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5750
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5751
                case PropertyDelete:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5752
                    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5753
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5754
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5755
                    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5756
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5757
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5758
            t = __MKUINT(pe->time); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5759
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5760
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5761
        case SelectionClear:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5762
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5763
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5764
            t = __MKUINT(sce->time); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5765
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5766
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5767
        case SelectionRequest:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5768
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5769
             * someone wants the selection
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5770
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5771
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5772
            t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5773
            __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5774
            __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5775
            __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5776
            t = __MKUINT(ev.xselectionrequest.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5777
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5778
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5779
        case SelectionNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5780
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5781
             * returned selection value (answer from SelectionRequest)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5782
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5783
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5784
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5785
            __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5786
            __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5787
            t = __MKEXTERNALADDRESS(ev.xselection.requestor); __ArrayInstPtr(anEventArray)->a_element[6] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5788
            t = __MKUINT(ev.xselection.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5789
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5790
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5791
        case ColormapNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5792
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5793
            __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5794
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5795
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5796
        case ClientMessage:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5797
            if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5798
                if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5799
                 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5800
                    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5801
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5802
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5803
                if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5804
                    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5805
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5806
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5807
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5808
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5809
             * any other client message
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5810
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5811
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5812
            __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5813
            __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format);
5736
fa0b6755ef24 changed: #getEventFor:withMask:into:
Stefan Vogel <sv@exept.de>
parents: 5716
diff changeset
  5814
            t = __MKBYTEARRAY(&ev.xclient.data, sizeof(ev.xclient.data)); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5815
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5816
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5817
        case MappingNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5818
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5819
            switch(mape->request) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5820
                case MappingModifier:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5821
                    arg = @symbol(mappingModifier);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5822
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5823
                case MappingKeyboard:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5824
                    arg = @symbol(mappingKeyboard);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5825
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5826
                case MappingPointer:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5827
                    arg = @symbol(mappingPointer);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5828
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5829
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5830
                    arg = __MKSMALLINT(mape->request);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5831
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5832
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5833
            __ArrayInstPtr(anEventArray)->a_element[3] = arg;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5834
            t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5835
            __STORE(anEventArray, t);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5836
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5837
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5838
        case KeymapNotify:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5839
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5840
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5841
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5842
        case MapRequest:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5843
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5844
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5845
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5846
        case ReparentNotify:
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5847
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:);
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5848
            t = __MKEXTERNALADDRESS(rpe->parent);
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5849
            __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5850
            __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x);
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5851
            __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y);
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5852
            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5853
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5854
        default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5855
            __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5856
            break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5857
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5858
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5859
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5860
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5861
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5862
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5863
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5864
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5865
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5866
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5867
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5868
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5869
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5870
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5871
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5872
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5873
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5874
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5875
#undef rr
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5876
#undef rpe
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5877
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  5878
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5879
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5880
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5881
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5882
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5883
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5884
    ^ true
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5885
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5886
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5887
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5888
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5889
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5890
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5891
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5892
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5893
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5894
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5895
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5896
    dispatchingExpose := aView id
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5897
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5898
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5899
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5900
    "tell X that we are only interested in events from aMask, which
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5901
     is the bitwise or of the eventMask bits (see 'eventMaskFor:')"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5902
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5903
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5904
%{
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5905
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5906
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5907
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5908
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5909
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5910
     && __isSmallInteger(aMask)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5911
        mask = __intVal(aMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5912
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5913
#ifdef OLD
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5914
        /* these may not be disabled */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5915
        mask |= ExposureMask | StructureNotifyMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5916
                KeyPressMask | KeyReleaseMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5917
                EnterWindowMask | LeaveWindowMask |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5918
                ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5919
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5920
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5921
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5922
        XSelectInput(myDpy, __WindowVal(aWindowId), mask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5923
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5924
        RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5925
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5926
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5927
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5928
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5929
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5930
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5931
    "redefined to clear dispatchingExpose, which is a special X feature"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5932
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5933
    dispatching ifTrue:[^ self].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5934
    dispatchingExpose := nil.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5935
    super startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5936
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5937
3885
f00086641b23 method category rename
Claus Gittinger <cg@exept.de>
parents: 3883
diff changeset
  5938
!XWorkstation methodsFor:'event handling-old dispatch'!
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5939
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5940
buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5941
    "forward a button-press event for some view"
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5942
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5943
    aView isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5944
        "/ event arrived, after I destroyed it myself
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5945
        ^ self
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5946
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5947
    button == 1 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5948
        activateOnClick == true ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5949
            "/ dont raise above an active popup view.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5950
            (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5951
                aView topView raise.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5952
"/            ] ifFalse:[
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5953
"/                activeKeyboardGrab printCR.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5954
"/                activePointerGrab printCR.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5955
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5956
        ].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5957
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5958
    super buttonPress:button x:x y:y view:aView
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5959
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5960
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5961
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5962
! !
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5963
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5964
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5965
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5966
sendClientEvent:msgType format:msgFormat to:targetWindowID propagate:propagate eventMask:eventMask window:windowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5967
    "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
  5968
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5969
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5970
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5971
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5972
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5973
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5974
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5975
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5976
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5977
    "/ Event.xclient.format            = msgFormat;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5978
    "/ Event.xclient.window            = windowID;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5979
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5980
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5981
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5982
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5983
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5984
    "/
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5985
    "/ XSendEvent(dpy, targetWindowID, propagate, eventMask, &Event);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5986
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5987
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5988
%{
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5989
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5990
    int state;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5991
    int __eventMask;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5992
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5993
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5994
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5995
     && __isInteger(msgFormat)
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5996
     && (eventMask == nil || __isInteger(eventMask))
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5997
     && (__isExternalAddress(windowID) || __isInteger(windowID))
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5998
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5999
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6000
        XEvent ev;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6001
        Status result;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6002
        Window targetWindow;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6003
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6004
        if (__isInteger(d1)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6005
            ev.xclient.data.l[0] = __longIntVal(d1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6006
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6007
            if (__isExternalAddress(d1)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6008
                ev.xclient.data.l[0] = (INT)__externalAddressVal(d1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6009
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6010
                ev.xclient.data.l[0] = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6011
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6012
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6013
        if (__isInteger(d2)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6014
            ev.xclient.data.l[1] = __longIntVal(d2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6015
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6016
            if (__isExternalAddress(d2)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6017
                ev.xclient.data.l[1] = (INT)__externalAddressVal(d2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6018
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6019
                ev.xclient.data.l[1] = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6020
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6021
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6022
        if (__isInteger(d3)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6023
            ev.xclient.data.l[2] = __longIntVal(d3);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6024
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6025
            if (__isExternalAddress(d3)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6026
                ev.xclient.data.l[2] = (INT)__externalAddressVal(d3);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6027
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6028
                ev.xclient.data.l[2] = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6029
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6030
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6031
        if (__isInteger(d4)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6032
            ev.xclient.data.l[3] = __longIntVal(d4);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6033
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6034
            if (__isExternalAddress(d4)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6035
                ev.xclient.data.l[3] = (INT)__externalAddressVal(d4);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6036
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6037
                ev.xclient.data.l[3] = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6038
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6039
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6040
        if (__isInteger(d5)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6041
            ev.xclient.data.l[4] = __longIntVal(d5);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6042
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6043
            if (__isExternalAddress(d5)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6044
                ev.xclient.data.l[4] = (INT)__externalAddressVal(d5);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6045
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6046
                ev.xclient.data.l[4] = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6047
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6048
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6049
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6050
        if (__isExternalAddress(windowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6051
            ev.xclient.window = __WindowVal(windowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6052
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6053
            ev.xclient.window = (Window)__longIntVal(windowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6054
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6055
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6056
        if (__isExternalAddress(targetWindowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6057
            targetWindow = __WindowVal(targetWindowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6058
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6059
            targetWindow = (Window)__longIntVal(targetWindowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6060
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6061
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6062
        ev.xclient.type              = ClientMessage;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6063
        ev.xclient.display           = dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6064
        ev.xclient.message_type      = __longIntVal(msgType);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6065
        ev.xclient.format            = __longIntVal(msgFormat);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6066
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6067
        if (eventMask == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6068
            __eventMask = NoEventMask;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6069
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6070
            __eventMask = __longIntVal(eventMask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6071
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6072
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6073
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6074
        result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6075
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6076
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6077
        if ((result == BadValue) || (result == BadWindow)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6078
            DPRINTF(("bad status in sendClientEvent\n"));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6079
            RETURN ( false )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6080
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6081
        RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6082
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6083
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6084
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6085
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6086
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6087
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6088
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
  6089
    "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
  6090
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6091
     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
  6092
     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
  6093
     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
  6094
     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
  6095
     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
  6096
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6097
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6098
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6099
%{
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6100
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6101
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6102
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6103
    if (__isSmallInteger(stateMask)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6104
        state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6105
    } else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6106
        state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6107
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6108
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6109
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6110
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  6111
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr))
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6112
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6113
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6114
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6115
        XEvent ev;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6116
        Window target;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6117
        Status result;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6118
        KeySym keySym, *syms;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6119
        int screen = __intVal(__INST(screen));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6120
        char s[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6121
        int nSyms;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6122
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6123
        if ((typeSymbol == @symbol(keyPress))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6124
         || (typeSymbol == @symbol(keyRelease))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6125
            if (__isStringLike(keySymCodeOrButtonNr)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6126
                keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6127
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6128
                if (__isCharacter(keySymCodeOrButtonNr)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6129
                    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6130
                    s[1] = '\0';
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6131
                    keySym = XStringToKeysym(s);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6132
                } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6133
                    keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6134
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6135
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6136
            ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6137
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6138
            if (stateMask == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6139
                /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6140
                 * get the modifier from the keySym
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6141
                 */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6142
                nSyms = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6143
                syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6144
                if (syms) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6145
                    int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6146
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6147
                    for (i=0; i<nSyms; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6148
                        if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6149
#ifdef MODIFIERDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6150
                            console_printf("modifier-index is %d\n", i);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6151
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6152
                            if (i) state = (1 << (i-1));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6153
                            break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6154
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6155
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6156
                    XFree(syms);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6157
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6158
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6159
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6160
            if ((typeSymbol == @symbol(buttonPress))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6161
             || (typeSymbol == @symbol(buttonRelease))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6162
                if (__isSmallInteger(keySymCodeOrButtonNr)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6163
                    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6164
                } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6165
                    ev.xbutton.button = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6166
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6167
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6168
                DPRINTF(("invalid sendEvent typeSymbol\n"));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6169
                RETURN (false);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6170
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6171
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6172
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6173
        if (typeSymbol == @symbol(keyPress))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6174
            ev.xany.type = KeyPress;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6175
        else if (typeSymbol == @symbol(keyRelease))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6176
            ev.xany.type = KeyRelease;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6177
        else if (typeSymbol == @symbol(buttonPress))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6178
            ev.xany.type = ButtonPress;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6179
        else if (typeSymbol == @symbol(buttonRelease))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6180
            ev.xany.type = ButtonRelease;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6181
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6182
        if (__isExternalAddress(targetId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6183
            target = __WindowVal(targetId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6184
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6185
            target = (Window) __longIntVal(targetId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6186
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6187
        ev.xkey.window = target;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6188
        ev.xkey.same_screen = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6189
        ev.xkey.subwindow = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6190
        ev.xkey.root = RootWindow(dpy, screen);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6191
        ev.xkey.x = __intVal(xPos);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6192
        ev.xkey.y = __intVal(yPos);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6193
        ev.xkey.state = state;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6194
        ev.xkey.time = CurrentTime;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6195
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6196
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6197
        result = XSendEvent(dpy, target, False, 0 , &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6198
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6199
        if ((result == BadValue) || (result == BadWindow)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6200
            DPRINTF(("bad status\n"));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6201
            RETURN ( false )
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6202
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6203
        RETURN (true)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6204
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6205
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6206
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6207
    ^ false
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6208
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6209
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6210
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6211
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6212
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6213
    "a basic method for X-font allocation; this method allows
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6214
     any font to be aquired (even those not conforming to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6215
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6216
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6217
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6218
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6219
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6220
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6221
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6222
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6223
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  6224
     && __isStringLike(aFontName)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6225
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6226
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6227
        newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6228
        LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6229
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6230
        if (newFont)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6231
            __cnt_font++;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6232
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6233
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6234
        RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6235
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6236
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  6237
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6238
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6239
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6240
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6241
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6242
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6243
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6244
     1 2     3      4    5     6         7 8      9    10   11   12 13 14       15
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6245
      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6246
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6247
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6248
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6249
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6250
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6251
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6252
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6253
    fields size == 3 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6254
        "take care of old font names: family-style-size"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6255
        family := fields at:1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6256
        style := fields at:2.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6257
        size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6258
    ] ifFalse:[fields size == 2 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6259
        "take care of old font names: family-size"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6260
        family := fields at:1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6261
        size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6262
    ] ifFalse:[fields size >= 15 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6263
        family := fields at:3.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6264
        face := fields at:4.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6265
        style := fields at:5.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6266
        style = 'o' ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6267
            style := 'oblique'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6268
        ] ifFalse:[style = 'i' ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6269
             style := 'italic'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6270
        ] ifFalse:[style = 'r' ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6271
             style := 'roman'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6272
        ]]].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6273
        moreStyle := fields at:6.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6274
        (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6275
            style := style, '-', moreStyle.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6276
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6277
        fheight := fields at:8.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6278
        size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6279
        resX := fields at:10.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6280
        resY := fields at:11.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6281
        registry := fields at:14.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6282
        encoding := fields at:15.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6283
        coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6284
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6285
        ^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6286
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6287
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6288
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6289
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6290
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6291
encodingOf:aFontId
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6292
    "the fonts encoding - if the font does not provide that info,
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6293
     return nil (and assume #ascii, which is a subset of #iso8859)."
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6294
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6295
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6296
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6297
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6298
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6299
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6300
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6301
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6302
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6303
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6304
    coll notNil ifTrue:[ coll := self atomName:coll].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6305
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6306
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6307
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6308
     "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6309
       Screen current encodingOf:Screen current getDefaultFont
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6310
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6311
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6312
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6313
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6314
    "given registry and encoding as returned by X11,
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6315
     generate a single symbol naming the ST/X encoding.
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6316
     I.e. from registry='ISO8859' and encoding='1', generate #'iso8859-1'.
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6317
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6318
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6319
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6320
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6321
    (registry size ~~ 0) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6322
        enc := registry asLowercase.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6323
        encoding size ~~ 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6324
           enc := enc, '-', encoding asLowercase.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6325
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6326
        enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6327
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6328
        (encoding size ~~ 0) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6329
            enc := encoding asLowercase asSymbol
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6330
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6331
            charSets := charSetCollections.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6332
            (charSets notEmptyOrNil) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6333
                charSets := charSets asUppercase asCollectionOfWords.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6334
                (charSets includes:'ISO8859-1') ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6335
                    enc := #'iso8859-1'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6336
                ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6337
                    (charSets includes:'ISO8859') ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6338
                        enc := #iso8859
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6339
                    ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6340
                        (charSets includes:'ASCII') ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6341
                            enc := #ascii
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6342
                        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6343
                            (charSets includes:'ADOBE-STANDARD') ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6344
                                enc := #iso8859
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6345
                            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6346
                        ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6347
                    ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6348
                ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6349
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6350
        ]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6351
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6352
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6353
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  6354
    "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
  6355
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6356
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6357
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6358
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6359
    "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
  6360
     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
  6361
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6362
    listOfXFonts := nil
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6363
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6364
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6365
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6366
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6367
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6368
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6369
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6370
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6371
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6372
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6373
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6374
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6375
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6376
     1 2     3      4    5     6         7 8      9    10   11   12 13 14       15
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6377
      -brand-family-face-style-moreStyle- -pxlSize-size-resX-resY-??-??-registry-encoding;
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6378
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6379
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6380
    |family face style moreStyle pxlSize size
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6381
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6382
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6383
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6384
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6385
    Error handle:[:ex |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6386
        family := nil.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6387
    ] do:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6388
        fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6389
        fields size == 3 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6390
            "take care of old font names: family-style-size"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6391
            family := fields at:1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6392
            style := fields at:2.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6393
            size := Number readFromString:(fields at:3).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6394
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6395
            fields size == 2 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6396
                "take care of old font names: family-size"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6397
                family := fields at:1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6398
                size := Number readFromString:(fields at:2).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6399
            ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6400
                fields size >= 15 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6401
                    family := fields at:3.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6402
                    face := fields at:4.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6403
                    style := fields at:5.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6404
                    style = 'o' ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6405
                        style := 'oblique'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6406
                    ] ifFalse:[style = 'i' ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6407
                         style := 'italic'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6408
                    ] ifFalse:[style = 'r' ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6409
                         style := 'roman'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6410
                    ]]].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6411
                    moreStyle := fields at:6.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6412
                    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6413
                        style := style, '-', moreStyle.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6414
                    ].
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6415
"/                    pxlSize := (Integer readFromString:(fields at:8)).
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6416
                    size := (Number readFromString:(fields at:9)) / 10.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6417
                    resX := fields at:10.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6418
                    resY := fields at:11.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6419
                    registry := fields at:14.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6420
                    encoding := fields at:15.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6421
                    coding := registry , '-' , encoding.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6422
                ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6423
                    "/ very old name (such as cursor, 5x7 etc)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6424
                ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6425
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6426
        ].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6427
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6428
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6429
    family notNil ifTrue:[
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6430
       ^ FontDescription family:family face:face style:style size:size sizeUnit:#pt encoding:coding.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6431
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6432
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6433
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6434
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6435
     Screen current fontDescriptionFromXFontName:'-arabic-newspaper-medium-r-normal--32-246-100-100-p-137-iso10646-1'
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6436
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6437
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6438
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6439
fontMetricsOf:fontId
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6440
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6441
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6442
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6443
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6444
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6445
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6446
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  6447
%{  /* UNLIMITEDSTACK */
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6448
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6449
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6450
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  6451
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6452
        if (__isExternalAddress(fontId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6453
            f = __FontVal(fontId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6454
            if (f) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6455
                minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6456
                maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6457
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6458
                if (f->direction == FontLeftToRight) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6459
                    dir = @symbol(LeftToRight);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6460
                } else if (f->direction == FontRightToLeft) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6461
                    dir = @symbol(RightToLeft);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6462
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6463
                avgAscent = __MKSMALLINT(f->ascent);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6464
                avgDescent = __MKSMALLINT(f->descent);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6465
                maxAscent = __MKSMALLINT(f->max_bounds.ascent);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6466
                maxDescent = __MKSMALLINT(f->max_bounds.descent);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6467
                minWidth = __MKSMALLINT(f->min_bounds.width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6468
                maxWidth = __MKSMALLINT(f->max_bounds.width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6469
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6470
                ENTER_XLIB();
5741
5cfdae180ad7 changed: #fontMetricsOf:
Stefan Vogel <sv@exept.de>
parents: 5736
diff changeset
  6471
                len = XTextWidth(f, "n", 1);
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6472
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6474
                avgWidth = __MKSMALLINT( len );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6475
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6476
        }
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6477
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  6478
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6479
    avgAscent == nil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6480
        self primitiveFailedOrClosedConnection.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6481
        ^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6482
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6483
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6484
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6485
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  6486
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6487
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6488
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6489
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6490
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6491
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6492
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6493
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6494
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6495
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6496
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6497
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6498
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6499
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  6500
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6501
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6502
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6503
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6504
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6505
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6506
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6507
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6508
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6509
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6510
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6511
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6512
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6513
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6514
     PropertyNames is an array with property names (symbols or strings).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6515
     Nonexistant properties are returned as nil"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6516
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6517
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6518
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6519
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6520
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6521
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6522
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6523
     Screen current
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6524
        fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' #'RESOLUTION' notExistant)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6525
        of:Screen current getDefaultFont
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6526
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6527
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6528
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6529
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6530
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6531
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6532
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6533
     Even indices contain the property value (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6534
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6535
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6536
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6537
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6538
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6539
%{
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6540
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6541
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6542
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6543
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6544
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6545
    if (__isExternalAddress(aFontId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6546
        f = __FontVal(aFontId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6547
        if (f && (prop = f->properties) != 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6548
            n = f->n_properties;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6549
            propsArray = __ARRAY_NEW_INT(n*2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6550
            for (i = 0; n; n--, prop++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6551
                x = __MKUINT(prop->name); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6552
                x = __MKUINT(prop->card32); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6553
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6554
        }
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6555
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6556
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6557
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6558
    propsArray notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6559
        propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6560
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6561
    ^ result
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6562
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6563
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6564
     Screen current fontPropertiesOf:Screen current getDefaultFont
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6565
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:Screen current getDefaultFont)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6566
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6567
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6568
     d := Dictionary new.
5510
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  6569
     (Screen current fontPropertiesOf:Screen current getDefaultFont) keysAndValuesDo:[:name :value|
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  6570
          d at:name put:((Screen current atomName:value) ? value)
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6571
     ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6572
     d
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6573
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6574
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6575
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6576
fontResolutionOf:fontId
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6577
    "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
  6578
     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
  6579
     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
  6580
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6581
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6582
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6583
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6584
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6585
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  6586
    (resX notNil and:[resY notNil]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6587
        ^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6588
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6589
    res := props at:3.
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6590
    res notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6591
        ^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6592
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6593
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6594
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6595
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6596
      Screen current fontResolutionOf:(Screen current getDefaultFont)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6597
    "
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6598
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6599
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  6600
fullFontNameOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6601
    "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
  6602
     used for user feed-back (for example: in the fontPanel).
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  6603
     If the display/font does not provide that info, return nil."
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6604
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6605
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  6606
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6607
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6608
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6609
        |fullNameID|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6610
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6611
        fullNameID := props at:try ifAbsent:nil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6612
        fullNameID notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6613
            fullName := self atomName:fullNameID.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6614
            fullName notEmptyOrNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6615
                ^ fullName
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6616
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6617
        ]
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6618
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6619
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6620
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6621
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6622
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6623
     Screen current fullFontNameOf:(Screen current getDefaultFont)
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6624
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6625
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6626
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6627
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6628
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6629
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6630
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6631
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6632
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6633
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6634
    int nnames = 30000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6635
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6636
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6637
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6638
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6639
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6640
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6641
        if (__isStringLike(pattern)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6642
            for (;;) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6643
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6644
                fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6645
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6646
                if (fonts == 0) RETURN(nil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6647
                if (available < nnames) break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6648
                XFreeFontNames(fonts);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6649
                nnames = available * 2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6650
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6651
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6652
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6653
             * now, that we know the number of font names,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6654
             * create the array ...
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6655
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6656
            arr = __ARRAY_NEW_INT(available);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6657
            if (arr != nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6658
                /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6659
                 * ... and fill it
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6660
                 */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6661
                for (i=0; i<available; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6662
                    __PROTECT__(arr);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6663
                    str = __MKSTRING(fonts[i]);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6664
                    __UNPROTECT__(arr);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6665
                    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6666
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6667
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6668
            XFreeFontNames(fonts);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6669
            RETURN (arr);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6670
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6671
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6672
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6673
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6674
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6675
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6676
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  6677
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6678
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6679
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6680
getDefaultFontWithEncoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6681
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6682
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6683
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6684
    |id|
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6685
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6686
    id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding.
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6687
    id isNil ifTrue:[
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6688
        id := self createFontFor:'fixed'
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6689
    ].
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6690
    ^ id.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6691
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6692
     "
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6693
       Screen current getDefaultFontWithEncoding:#'iso10646-1'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6694
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6695
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6696
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6697
getFontWithFamily:familyString face:faceString
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6698
            style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6699
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6700
    "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
  6701
     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
  6702
     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
  6703
     can be aquired that way."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6704
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6705
    |styleString theName theId xlatedStyle
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6706
     id spacing encodingMatch idx roundedSize pixelSize pointSize|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6707
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6708
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6709
5176
0c9f21d81a71 preps for pixel-sized fonts
Claus Gittinger <cg@exept.de>
parents: 5071
diff changeset
  6710
    sizeArgOrNil notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6711
        roundedSize := sizeArgOrNil rounded asInteger.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6712
        sizeUnit == #px ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6713
            pixelSize := roundedSize.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6714
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6715
            pointSize := roundedSize.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6716
        ].
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6717
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  6718
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6719
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6720
    faceString isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6721
        roundedSize notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6722
            theName := familyString , '-' , roundedSize printString
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6723
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6724
            theName := familyString
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6725
        ].
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6726
        theName notNil ifTrue:[
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6727
            theId := self createFontFor:theName.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6728
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6729
        theId isNil ifTrue:[
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  6730
            theId := self getDefaultFontWithEncoding:encoding
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6731
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6732
        ^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6733
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6734
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6735
    "/ 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
  6736
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6737
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  6738
    (styleString notNil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6739
     and:[(styleString endsWith:'-narrow')
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6740
          or:[styleString endsWith:'-semicondensed']]) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6741
        |i|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6742
        i := styleString lastIndexOf:$-.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6743
        spacing := styleString copyFrom:(i+1).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6744
        styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6745
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6746
        spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6747
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6748
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6749
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6750
    xlatedStyle notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6751
        xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  6752
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  6753
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6754
    encoding isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6755
        encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6756
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6757
        idx := encoding indexOf:$-.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6758
        idx ~~ 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6759
            encodingMatch := encoding
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6760
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6761
            encodingMatch := encoding , '-*'.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6762
        ].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6763
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6764
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6765
    id := self
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6766
            getFontWithFoundry:'*'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6767
            family:familyString asLowercase
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6768
            weight:faceString
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6769
            slant:xlatedStyle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6770
            spacing:spacing
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6771
            pixelSize:pixelSize
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6772
            size:pointSize
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6773
            encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6774
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6775
    id isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6776
        (encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6777
            "/ too stupid: registries come in both cases
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6778
            "/ and X does not ignore case
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6779
            "/
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6780
            id := self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6781
                    getFontWithFoundry:'*'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6782
                    family:familyString asLowercase
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6783
                    weight:faceString
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6784
                    slant:xlatedStyle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6785
                    spacing:spacing
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6786
                    pixelSize:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6787
                    size:roundedSize
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6788
                    encoding:encodingMatch asUppercase.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6789
            id isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6790
                id := self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6791
                        getFontWithFoundry:'*'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6792
                        family:familyString asLowercase
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6793
                        weight:faceString
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6794
                        slant:xlatedStyle
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6795
                        spacing:spacing
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6796
                        pixelSize:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6797
                        size:roundedSize
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6798
                        encoding:encodingMatch asLowercase.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6799
            ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6800
        ]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6801
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6802
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6803
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6804
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6805
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6806
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6807
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6808
getFontWithFoundry:foundry family:family weight:weight
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6809
              slant:slant spacing:spc pixelSize:pSize size:size
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6810
              encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6811
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6812
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6813
     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
  6814
     use this entry.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6815
     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
  6816
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6817
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6818
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6819
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6820
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6821
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6822
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6823
     size:      size in point (1/72th of an inch)
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6824
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6825
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6826
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6827
    |theName sizeMatch
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6828
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  6829
     pSizeMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6830
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6831
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6832
    "name is:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6833
        -foundry-family    -weight -slant-
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6834
         sony    helvetica bold     r
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6835
         adobe   courier   medium   i
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6836
         msic    fixed              o
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6837
         ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6838
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6839
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6840
    size isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6841
        sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6842
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6843
        sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6844
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6845
    foundry isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6846
        foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6847
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6848
        foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6849
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6850
    family isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6851
        familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6852
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6853
        familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6854
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6855
    weight isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6856
        weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6857
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6858
        weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6859
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6860
    slant isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6861
        slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6862
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6863
        slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6864
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6865
    spc isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6866
        spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6867
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6868
        spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6869
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6870
    pSize isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6871
        pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6872
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6873
        pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6874
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6875
    encoding isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6876
        encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6877
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6878
        encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6879
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6880
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6881
    theName := ('-' , foundryMatch,
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6882
                '-' , familyMatch,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6883
                '-' , weightMatch ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6884
                '-' , slantMatch ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6885
                '-' , spcMatch ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6886
                '-*' ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6887
                '-' , pSizeMatch ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6888
                '-' , sizeMatch ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6889
                '-*-*-*-*' ,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6890
                '-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6891
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  6892
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6893
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6894
    ^ self createFontFor:theName.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6895
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6896
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6897
    "
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6898
     Display
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6899
        getFontWithFoundry:'*'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6900
        family:'courier'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6901
        weight:'medium'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6902
        slant:'r'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6903
        spacing:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6904
        pixelSize:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6905
        size:13
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6906
        encoding:'iso8859-*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6907
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6908
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6909
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6910
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6911
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6912
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6913
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6914
     Since this takes some time, keep the result of the query for the
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6915
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6916
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6917
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6918
    |names|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6919
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6920
    listOfXFonts isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6921
        names := self getAvailableFontsMatching:'*'.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6922
        names isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6923
            "no names returned ..."
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6924
            ^ nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6925
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6926
        listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
5510
dd955c30480a comment/format in: #fontPropertiesOf:
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  6927
        listOfXFonts := FontDescription genericFonts, listOfXFonts.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6928
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6929
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6930
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6931
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6932
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6933
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6934
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  6935
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6936
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  6937
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6938
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6939
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6940
    "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
  6941
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6942
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6943
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6944
pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6945
    "return a set of all available font sizes in aFamily/aFace/aStyle
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6946
     on this display.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6947
     Redefined to handle X's special case of 0-size (which stands for any)"
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6948
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6949
    |sizes|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6950
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6951
    sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6952
    (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6953
        "special: in X11R5 and above, size 0 means:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6954
         there are scaled versions in all sizes available"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6955
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6956
        ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288)
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6957
    ].
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6958
    ^ sizes
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6959
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6960
    "
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6961
     Display sizesInFamily:'courier' face:'bold' style:'roman'
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6962
    "
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6963
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6964
    "Created: 27.2.1996 / 01:38:15 / cg"
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6965
!
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  6966
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6967
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6968
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6969
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6970
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6971
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6972
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  6973
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  6974
     * ignore closed connection
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  6975
     */
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6976
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6977
        RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6978
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6979
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6980
    if (__isExternalAddress(aFontId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6981
        f = __FontVal(aFontId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6982
        if (f) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6983
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6984
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6985
            XFreeFont(myDpy, f);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6986
            LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6987
#ifdef COUNT_RESOURCES
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6988
            __cnt_font--;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6989
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6990
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  6991
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6992
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6993
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6994
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6995
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6996
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6997
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6998
    "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
  6999
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7000
     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
  7001
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7002
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7003
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  7004
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7005
    (sizes notNil and:[sizes includes:0]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7006
        "special: in X11R5 and above, size 0 means:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7007
         there are scaled versions in all sizes available"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7008
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7009
        ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7010
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7011
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7012
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7013
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7014
     Display sizesInFamily:'courier' face:'bold' style:'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7015
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  7016
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  7017
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7018
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7019
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7020
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7021
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7022
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7023
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7024
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7025
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7026
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7027
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7028
    int len, n, i1, i2, l;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7029
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7030
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  7031
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7032
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7033
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7034
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7035
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7036
        if (__bothSmallInteger(index1, index2)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7037
         && __isExternalAddress(aFontId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7038
         && __isNonNilObject(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7039
            int lMax = __intVal(@global(MaxStringLength));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7040
            f = __FontVal(aFontId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7041
            if (! f) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7042
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7043
            i1 = __intVal(index1) - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7044
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7045
            if (i1 >= 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7046
                OBJ cls;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7047
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7048
                i2 = __intVal(index2) - 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7049
                if (i2 < i1) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7050
                    RETURN ( __MKSMALLINT(0) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7051
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7052
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7053
                cp = (char *) __stringVal(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7054
                l = i2 - i1 + 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7055
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7056
                if (__isStringLike(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7057
                    n = __stringSize(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7058
                    if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7059
                        cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7060
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7061
#if 0
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7062
                        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7063
                        len = XQueryTextExtents(myDpy, f->fid, cp, l,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7064
                                                &directionReturn, &fontAscentReturn, &fontDescentReturn,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7065
                                                &overAllReturn);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7066
                        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7067
                        console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7068
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7069
                        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7070
                        len = XTextWidth(f, cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7071
                        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7072
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7073
                        RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7074
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7075
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7076
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7077
                cls = __qClass(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7078
                nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7079
                cp += nInstBytes;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7080
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7081
                if (__isBytes(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7082
                    n = __byteArraySize(aString) - nInstBytes;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7083
                    if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7084
                        cp += i1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7085
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7086
                        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7087
                        len = XTextWidth(f, cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7088
                        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7089
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7090
                        RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7091
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7092
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7093
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7094
                /* TWOBYTESTRINGS */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7095
                if (__isWords(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7096
                    n = (__byteArraySize(aString) - nInstBytes) / 2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7097
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7098
                    if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7099
                        union {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7100
                            char b[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7101
                            unsigned short s;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7102
                        } u;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7103
                        int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7104
                        XChar2b *cp2 = (XChar2b *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7105
                        int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7106
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7107
                        cp += (i1 * 2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7108
                        if (l > lMax) l = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7109
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7110
                        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7111
                         * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7112
                         * X expects them MSB first
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7113
                         * convert as required
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7114
                         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7115
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7116
                        u.s = 0x1234;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7117
                        if (u.b[0] != 0x12) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7118
                            if (l <= NLOCALBUFFER) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7119
                                cp2 = xlatebuffer;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7120
                            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7121
                                cp2 = (XChar2b *)(malloc(l * 2));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7122
                                mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7123
                            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7124
                            for (i=0; i<l; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7125
                                cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7126
                                cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7127
                            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7128
                            cp = (char *) cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7129
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7130
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7131
                        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7132
                        len = XTextWidth16(f, (XChar2b *)cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7133
                        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7134
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7135
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7136
                        if (mustFree) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7137
                            free(cp2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7138
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7139
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7140
                        RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7141
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7142
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7143
                /* FOURBYTESTRINGS */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7144
                if (__isLongs(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7145
                    int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7146
                    XChar2b *cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7147
                    int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7148
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7149
                    n = (__byteArraySize(aString) - nInstBytes) / 4;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7150
                    if (i2 < n) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7151
                        union {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7152
                            char b[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7153
                            unsigned short s;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7154
                        } u;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7155
                        int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7156
                        XChar2b *cp2 = (XChar2b *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7157
                        int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7158
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7159
                        cp += (i1 * 4);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7160
                        if (l > lMax) l = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7161
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7162
                        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7163
                         * For now: X does not support 32bit characters without the new 32Unicode extensions.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7164
                         * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7165
                         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7166
                        if (l <= NLOCALBUFFER) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7167
                            cp2 = xlatebuffer;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7168
                        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7169
                            cp2 = (XChar2b *)(malloc(l * 2));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7170
                            mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7171
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7172
                        for (i=0; i<l; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7173
                            int codePoint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7174
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7175
                            codePoint = ((unsigned int32 *)cp)[i];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7176
                            if (codePoint > 0xFFFF) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7177
                                codePoint = 0xFFFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7178
                            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7179
                            cp2[i].byte1 = codePoint & 0xFF;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7180
                            cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7181
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7182
                        cp = (char *) cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7183
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7184
                        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7185
                        len = XTextWidth16(f, (XChar2b *)cp, l);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7186
                        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7187
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7188
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7189
                        if (mustFree) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7190
                            free(cp2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7191
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7192
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7193
                        RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7194
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7195
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7196
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7197
        }
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7198
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7199
#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
  7200
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7201
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7202
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  7203
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7204
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7205
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7206
widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7207
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7208
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7209
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7210
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7211
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7212
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7213
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7214
    int len, n;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  7215
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7216
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7217
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  7218
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7219
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7220
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7221
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7222
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7223
        if (__isExternalAddress(aFontId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7224
         && __isNonNilObject(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7225
            int lMax = __intVal(@global(MaxStringLength));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7226
            f = __FontVal(aFontId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7227
            if (! f) goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7228
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7229
            cp = (char *) __stringVal(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7230
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7231
            if (__isStringLike(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7232
                n = __stringSize(aString);
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7233
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  7234
#if 0
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7235
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7236
                len = XQueryTextExtents(myDpy, f->fid, cp, n,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7237
                                        &directionReturn, &fontAscentReturn, &fontDescentReturn,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7238
                                        &overAllReturn);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7239
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7240
                console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7241
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7242
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7243
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7244
                len = XTextWidth(f, cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7245
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7246
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7247
                RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7248
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7249
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7250
            cls = __qClass(aString);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7251
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7252
            cp += nInstBytes;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7253
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7254
            if (__isBytes(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7255
                n = __byteArraySize(aString) - nInstBytes;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7256
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7257
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7258
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7259
                len = XTextWidth(f, cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7260
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7261
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7262
                RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7263
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7264
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7265
            /* TWOBYTESTRINGS */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7266
            if (__isWords(aString)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7267
                union {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7268
                    char b[2];
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7269
                    unsigned short s;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7270
                } u;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7271
                int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7272
                XChar2b *cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7273
                int mustFree = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7274
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7275
                n = (__byteArraySize(aString) - nInstBytes) / 2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7276
                if (n > lMax) n = lMax;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7277
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7278
                /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7279
                 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7280
                 * X expects them MSB first
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7281
                 * convert as required
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7282
                 */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7283
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7284
                u.s = 0x1234;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7285
                if (u.b[0] != 0x12) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7286
                    if (n <= NLOCALBUFFER) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7287
                        cp2 = xlatebuffer;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7288
                    } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7289
                        cp2 = (XChar2b *)(malloc(n * 2));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7290
                        mustFree = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7291
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7292
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7293
                    for (i=0; i<n; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7294
                        cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7295
                        cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7296
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7297
                    cp = (char *) cp2;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7298
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7299
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7300
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7301
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7302
                len = XTextWidth16(f, (XChar2b *)cp, n);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7303
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7304
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7305
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7306
                if (mustFree) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7307
                    free(cp2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7308
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7309
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7310
                RETURN ( __MKSMALLINT(len) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7311
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7312
        }
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7313
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  7314
#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
  7315
  fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  7316
%}.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  7317
    ^ super widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7318
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7319
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  7320
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7321
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7322
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7323
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7324
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7325
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7326
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7327
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7328
    if (mode == @symbol(asyncPointer))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7329
        _mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7330
    else if (mode == @symbol(syncPointer))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7331
        _mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7332
    else if (mode == @symbol(asyncKeyboard))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7333
        _mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7334
    else if (mode == @symbol(syncKeyboard))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7335
        _mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7336
    else if (mode == @symbol(syncBoth))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7337
        _mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7338
    else if (mode == @symbol(asyncBoth))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7339
        _mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7340
    else if (mode == @symbol(replayPointer))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7341
        _mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7342
    else if (mode == @symbol(replayKeyboard))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7343
        _mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7344
    else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7345
        ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7346
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7347
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7348
     && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7349
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7350
        XAllowEvents(myDpy, _mode, CurrentTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7351
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7352
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7353
        RETURN (self);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7354
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7355
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7356
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7357
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7358
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7359
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7360
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7361
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7362
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7363
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7364
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7365
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7366
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7367
        if (__isExternalAddress(aWindowId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7368
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7369
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7370
            result = XGrabKeyboard(myDpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7371
                                   __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7372
                                   True /* False */,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7373
                                   GrabModeAsync,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7374
                                   GrabModeAsync,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7375
                                   CurrentTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7376
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7377
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7378
            ok = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7379
            switch(result) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7380
                case AlreadyGrabbed:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7381
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7382
                        console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7383
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7384
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7385
                case GrabNotViewable:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7386
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7387
                        console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7388
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7389
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7390
                case GrabInvalidTime:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7391
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7392
                        console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7393
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7394
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7395
                case GrabFrozen:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7396
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7397
                        console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7398
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7399
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7400
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7401
                    ok = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7402
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7403
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7404
            if (! ok) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7405
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7406
                XUngrabKeyboard(myDpy, CurrentTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7407
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7408
                RETURN (false);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7409
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7410
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7411
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7412
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7413
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  7414
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7415
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7416
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7417
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7418
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7419
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
  7420
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7421
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7422
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7423
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7424
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7425
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7426
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7427
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7428
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7429
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7430
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7431
        if (__isExternalAddress(aWindowId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7432
            if (__isExternalAddress(confineId))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7433
                confineWin = __WindowVal(confineId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7434
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7435
                confineWin = (Window) None;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7436
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7437
            if (__isExternalAddress(aCursorId))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7438
                curs = __CursorVal(aCursorId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7439
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7440
                curs = (Cursor) None;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7441
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7442
            if (pMode == @symbol(sync))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7443
                pointer_mode = GrabModeSync;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7444
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7445
                pointer_mode = GrabModeAsync;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7446
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7447
            if (kMode == @symbol(sync))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7448
                keyboard_mode = GrabModeSync;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7449
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7450
                keyboard_mode = GrabModeAsync;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7451
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7452
            if (__isSmallInteger(eventMask))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7453
                evMask = __intVal(eventMask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7454
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7455
                evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7456
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7457
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7458
/*
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7459
            ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7460
*/
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7461
            result = XGrabPointer(myDpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7462
                                  __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7463
                                  False,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7464
                                  evMask,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7465
                                  pointer_mode, keyboard_mode,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7466
                                  confineWin,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7467
                                  curs,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7468
                                  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7469
/*
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7470
            LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7471
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7472
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7473
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7474
            ok = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7475
            switch (result) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7476
                case AlreadyGrabbed:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7477
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7478
                        console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7479
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7480
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7481
                case GrabNotViewable:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7482
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7483
                        console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7484
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7485
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7486
                case GrabInvalidTime:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7487
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7488
                        console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7489
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7490
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7491
                case GrabFrozen:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7492
                    if (@global(ErrorPrinting) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7493
                        console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7494
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7495
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7496
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7497
                    ok = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7498
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7499
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7500
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7501
            if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7502
/*
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7503
                ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7504
*/
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7505
                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
  7506
/*
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7507
                LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7508
*/
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7509
                RETURN (false);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7510
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7511
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7512
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7513
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  7514
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7515
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7516
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7517
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7518
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7519
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
  7520
    "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
  7521
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7522
    ^ self
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7523
        grabPointerIn:aWindowId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7524
        withCursor:aCursorId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7525
        eventMask:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7526
        pointerMode:pMode
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7527
        keyboardMode:kMode
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7528
        confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7529
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7530
    "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
  7531
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  7532
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7533
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7534
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7535
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7536
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7537
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7538
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7539
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7540
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7541
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7542
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7543
        XUngrabKeyboard(dpy, CurrentTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7544
        XSync(dpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7545
        LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7546
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7547
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7548
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7549
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7550
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7551
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7552
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7553
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7554
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7555
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7556
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7557
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7558
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7559
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7560
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7561
        XUngrabPointer(dpy, CurrentTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7562
        XSync(dpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7563
        LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7564
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7565
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7566
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7567
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7568
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7569
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7570
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  7571
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7572
    activeKeyboardGrab notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7573
        activeKeyboardGrab := nil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7574
        self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  7575
    ]
295
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7578
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7579
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7580
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  7581
    activePointerGrab notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7582
        activePointerGrab := nil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7583
        self primUngrabPointer.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  7584
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7585
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7586
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7587
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7588
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7589
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7590
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7591
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7592
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7593
%{
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
    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
  7596
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7597
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7598
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7599
        if (__isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7600
            gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7601
            gcv.clip_mask = None;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7602
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7603
            XChangeGC(myDpy, gc, GCClipMask, &gcv);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7604
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7605
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7606
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7607
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7608
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7609
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7610
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7611
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7612
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7613
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7614
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7615
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7616
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7617
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7618
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7619
        if (__isExternalAddress(aGCId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7620
         && __isSmallInteger(bgColorIndex)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7621
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7622
            XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7623
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7624
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7625
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7626
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7627
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7628
    self primitiveFailedOrClosedConnection
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7631
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7632
    "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
  7633
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7634
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7635
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7636
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7637
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7638
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7639
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7640
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7641
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7642
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7643
        if (__isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7644
            gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7645
            if (__isExternalAddress(aBitmapId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7646
                bitmap = __PixmapVal(aBitmapId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7647
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7648
                XSetStipple(dpy, gc, bitmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7649
                XSetFillStyle(dpy, gc, FillOpaqueStippled);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7650
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7651
                RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7652
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7653
            if (aBitmapId == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7654
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7655
                XSetFillStyle(dpy, gc, FillSolid);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7656
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7657
                RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7658
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7659
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7660
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7661
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7662
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7663
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7664
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  7665
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7666
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7667
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7668
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7669
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7670
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7671
    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
  7672
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7673
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7674
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7675
        if (__isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7676
            gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7677
            if (aBool == true)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7678
                gcv.subwindow_mode = ClipByChildren;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7679
            else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7680
                gcv.subwindow_mode = IncludeInferiors;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7681
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7682
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7683
            XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7684
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7685
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7686
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7687
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7688
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7689
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7690
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7691
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7692
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
  7693
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7694
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7695
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7696
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7697
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7698
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7699
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7700
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7701
        if (__isExternalAddress(aGCId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7702
         && __bothSmallInteger(clipX, clipY)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7703
         && __bothSmallInteger(clipWidth, clipHeight)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7704
            r.x = __intVal(clipX);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7705
            r.y = __intVal(clipY);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7706
            r.width = __intVal(clipWidth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7707
            r.height = __intVal(clipHeight);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7708
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7709
            XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7710
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7711
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7712
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7713
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7714
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7715
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7716
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7717
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7718
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7719
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7720
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7721
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7722
%{
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7723
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7724
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7725
        if (__isExternalAddress(aGCId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7726
         && __isSmallInteger(offset)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7727
         && __isByteArrayLike(dashList)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7728
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7729
            XSetDashes(myDpy, __GCVal(aGCId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7730
                       __intVal(offset),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7731
                       __ByteArrayInstPtr(dashList)->ba_element,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7732
                       __byteArraySize(dashList));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7733
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7734
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7735
        }
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7736
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7737
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7738
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7739
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7740
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7741
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7742
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7743
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7744
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7745
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7746
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7747
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7748
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7749
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7750
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7751
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7752
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7753
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7754
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7755
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7756
        if (__isExternalAddress(aFontId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7757
         && __isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7758
            f = (XFontStruct *) __FontVal(aFontId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7759
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7760
            XSetFont(myDpy, __GCVal(aGCId), f->fid);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7761
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7762
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7763
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7764
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7765
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7766
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7767
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7768
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7769
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7770
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7771
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7772
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7773
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7774
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7775
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7776
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7777
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7778
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7779
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7780
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7781
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7782
        if (__bothSmallInteger(fgColorIndex, bgColorIndex)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7783
         && __isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7784
            gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7785
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7786
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7787
            XSetForeground(dpy, gc, __intVal(fgColorIndex));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7788
            XSetBackground(dpy, gc, __intVal(bgColorIndex));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7789
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7790
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7791
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7792
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7793
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7794
    self primitiveFailedOrClosedConnection
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
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7798
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7799
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7800
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7801
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7802
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7803
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7804
        if (__isExternalAddress(aGCId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7805
         && __isSmallInteger(fgColorIndex)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7806
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7807
            XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7808
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7809
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7810
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7811
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7812
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7813
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7814
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7815
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7816
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7817
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7818
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7819
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7820
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7821
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7822
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7823
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7824
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7825
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7826
        if (__isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7827
            gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7828
            if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7829
            else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7830
            else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7831
            else if (aFunctionSymbol == @symbol(and)) fun = GXand;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7832
            else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7833
            else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7834
            else if (aFunctionSymbol == @symbol(or)) fun = GXor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7835
            else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7836
            else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7837
            else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7838
            else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7839
            else if (aFunctionSymbol == @symbol(set)) fun = GXset;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7840
            else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7841
            else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7842
            else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7843
            if (fun != -1) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7844
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7845
                XSetFunction(myDpy, gc, fun);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7846
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7847
                RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7848
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7849
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7850
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7851
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7852
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7853
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7854
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7855
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7856
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7857
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7858
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7859
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7860
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7861
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7862
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7863
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7864
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7865
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7866
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7867
        if (__isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7868
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7869
            XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7870
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7871
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7872
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7873
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7874
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7875
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7876
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7877
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7878
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7879
    "set line attributes;
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7880
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7881
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7882
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7883
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7884
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7885
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7886
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7887
    int x_style, x_cap, x_join;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7888
    static char dashList[2] = { 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7889
    static char dotList[2]  = { 4,4 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7890
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7891
    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
  7892
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7893
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7894
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7895
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7896
        if (__isExternalAddress(aGCId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7897
         && __isSmallInteger(aNumber)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7898
            Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7899
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7900
            if (lineStyle == @symbol(solid)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7901
                x_dashes = (char *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7902
                x_style = LineSolid;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7903
            } else if (lineStyle == @symbol(dashed)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7904
                x_dashes = dashList;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7905
                x_nDash = sizeof(dashList);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7906
                x_style = LineOnOffDash;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7907
            } else if (lineStyle == @symbol(doubleDashed)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7908
                x_dashes = dashList;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7909
                x_nDash = sizeof(dashList);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7910
                x_style = LineDoubleDash;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7911
            } else if (lineStyle == @symbol(dotted)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7912
                x_dashes = dotList;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7913
                x_nDash = sizeof(dotList);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7914
                x_style = LineOnOffDash;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7915
            } else if (lineStyle == @symbol(dashDot)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7916
                x_dashes = dashDotList;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7917
                x_nDash = sizeof(dashDotList);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7918
                x_style = LineOnOffDash;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7919
            } else if (lineStyle == @symbol(dashDotDot)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7920
                x_dashes = dashDotDotList;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7921
                x_nDash = sizeof(dashDotDotList);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7922
                x_style = LineOnOffDash;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7923
            } else goto bad;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7924
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7925
            if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7926
            else if (capStyle == @symbol(butt)) x_cap = CapButt;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7927
            else if (capStyle == @symbol(round)) x_cap  = CapRound;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7928
            else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7929
            else goto bad;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7930
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7931
            if (joinStyle == @symbol(miter)) x_join = JoinMiter;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7932
            else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7933
            else if (joinStyle == @symbol(round)) x_join  = JoinRound;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7934
            else goto bad;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7935
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7936
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7937
            if (x_dashes) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7938
                XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7939
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7940
            XSetLineAttributes(dpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7941
                               __GCVal(aGCId), __intVal(aNumber),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7942
                               x_style, x_cap, x_join);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7943
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7944
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7945
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7946
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7947
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7948
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7949
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7950
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7951
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7952
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7953
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7954
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7955
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7956
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7957
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7958
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7959
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7960
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7961
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7962
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7963
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7964
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7965
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7966
        if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7967
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7968
            XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7969
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7970
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7971
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7972
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7973
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7974
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7975
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7976
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7977
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7978
    "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
  7979
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7980
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7981
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7982
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7983
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7984
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7985
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7986
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7987
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7988
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7989
        if (__isExternalAddress(aGCId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7990
            gc = __GCVal(aGCId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7991
            if (__isExternalAddress(aPixmapId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7992
                pixmap = __PixmapVal(aPixmapId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7993
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7994
                XSetTile(dpy, gc, pixmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7995
                XSetFillStyle(dpy, gc, FillTiled);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7996
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7997
                RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7998
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  7999
            if (aPixmapId == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8000
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8001
                XSetFillStyle(dpy, gc, FillSolid);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8002
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8003
                RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8004
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8005
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8006
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8007
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8008
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8009
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8010
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  8011
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8012
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8013
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8014
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8015
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8016
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8017
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8018
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8019
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  8020
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  8021
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8022
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8023
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8024
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8025
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8026
        __INST(displayId) = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8027
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8028
        XCloseDisplay(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8029
        LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8030
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8031
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8032
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8033
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8034
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8035
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8036
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8037
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8038
%{
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8039
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8040
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8041
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8042
        __INST(displayId) = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8043
        close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8044
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8045
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8046
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  8047
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8048
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8049
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8050
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8051
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8052
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  8053
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8054
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  8055
    activateOnClick := false.
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  8056
    super initializeDefaultValues.
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8057
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8058
    "JV@2012: On X11, mouse buttons are: left=1, middle=2, right=3
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8059
    Even on 2-button mouse (button 2 is simply not reported). 
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8060
    Here the middle button is mapped to button #paste (which in EditTextView 
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8061
    pastes the PRIMARY selection). 128 is here to make clear that this
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8062
    is somewhat special value.
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8063
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8064
    This remapping kludge is here to have all the widget's code backward/windows 
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8065
    compatible while still having X11's middle button behavior.
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8066
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8067
    Also note, that buttonTranslation is overwritten in display.rc,
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8068
    the code is here just for a case display.rc is not read/available
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8069
    and for documentation (symbol references does not search .rc files).
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8070
    "
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8071
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  8072
    buttonTranslation at: 2 put: #paste
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8073
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  8074
    "Modified (comment): / 17-04-2012 / 21:18:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8075
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8076
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8077
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8078
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8079
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  8080
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  8081
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8082
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8083
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8084
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8085
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8086
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8087
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8088
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8089
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8090
     the argument, aDisplayName may be nil (for the default server from
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8091
     DISPLAY-variable or command line argument) or the name of the server
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8092
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8093
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8094
    displayId notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8095
        "/ already connected - you bad guy try to trick me manually ?
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8096
        ^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  8097
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  8098
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  8099
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8100
    displayId isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8101
        "/ could not connect.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8102
        DeviceOpenErrorSignal raiseWith:aDisplayName.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8103
        ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8104
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8105
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8106
    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8107
    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  8108
    hasConnectionBroken := false.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8109
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8110
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8111
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8112
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8113
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8114
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8115
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8116
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8117
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8118
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  8119
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8120
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8121
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8122
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8123
    atoms := nil.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  8124
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  8125
    "These values are initialized by primitive code in #createWindowFor:..."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8126
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8127
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8128
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8129
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8130
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  8131
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8132
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8133
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8134
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8135
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8136
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  8137
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  8138
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  8139
    self initializeViewStyle.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8140
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8141
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8142
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  8143
    "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
  8144
     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
  8145
     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
  8146
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  8147
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8148
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8149
    super initializeModifierMappings.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8150
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8151
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  8152
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8153
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  8154
    map isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8155
        "/
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8156
        "/ mhmh - a crippled Xlib which does not provide modifier mappings
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8157
        "/ setup some reasonable default. If that is not sufficient,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8158
        "/ you have to change things from your display.rc file.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8159
        "/
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8160
        altModifierMask := self modifier1Mask.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8161
        metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  8162
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8163
        | mod stringFromKeyCode nonNilOnes |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8164
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8165
        altModifierMask := 0.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8166
        metaModifierMask := 0.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8167
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8168
        stringFromKeyCode := [:key |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8169
                                    |s|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8170
                                    s := self stringFromKeycode:key.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8171
                                    s notNil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8172
                                        ifTrue:[s asSymbol]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8173
                                        ifFalse:[nil]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8174
                             ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8175
        nonNilOnes := [:str | str notNil].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8176
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8177
        mod := map at:1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8178
        mod notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8179
            shiftModifiers := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8180
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8181
        mod := map at:3.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8182
        mod notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8183
            ctrlModifiers  := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8184
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8185
        mod := map at:4.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8186
        mod notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8187
            mod := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8188
            (mod includes:'Num_Lock') ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8189
                metaModifiers := mod.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8190
                metaModifierMask := 1 bitShift:(4-1).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8191
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8192
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8193
        mod := map at:5.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8194
        mod notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8195
            mod := (mod collect:stringFromKeyCode thenSelect:nonNilOnes) asArray.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8196
            (mod includes:'Num_Lock') ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8197
                altModifiers   := mod.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8198
                altModifierMask := 1 bitShift:(5-1).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8199
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8200
        ]
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8201
    ].
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  8202
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  8203
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  8204
     Display initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  8205
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8206
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8207
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8208
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8209
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8210
initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8211
    self isXineramaActive ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8212
        |rect|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8213
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8214
        self monitorBounds do:[:eachRect|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8215
            rect isNil ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8216
                rect := eachRect.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8217
            ] ifFalse:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8218
                rect := rect merge:eachRect.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8219
            ]
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8220
        ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8221
        width := rect width.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8222
        height := rect height.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8223
    
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8224
        "propagate possible size changes to our rottView"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8225
        rootView notNil ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8226
            rootView initialize.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8227
        ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8228
    ] ifFalse:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8229
        width := self queryWidth.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8230
        height := self queryHeight.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8231
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8232
    widthMM := self queryWidthMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8233
    heightMM := self queryHeightMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8234
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8235
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8236
      Display initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8237
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8238
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  8239
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8240
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8241
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8242
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  8243
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  8244
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8245
    hasShapeExtension := self queryShapeExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8246
    hasShmExtension := self querySHMExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8247
    hasDPSExtension := self queryDPSExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8248
    hasXVideoExtension := self queryXVideoExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8249
    hasMbufExtension := self queryMBUFExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8250
    hasPEXExtension := self queryPEXExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8251
    hasImageExtension := self queryXIEExtension.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8252
    hasInputExtension := self queryXIExtension.
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  8253
    hasXineramaExtension := self queryXineramaExtension.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8254
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8255
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  8256
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  8257
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8258
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8259
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8260
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8261
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8262
    screen := self queryDefaultScreen.
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  8263
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  8264
    self initializeScreenBounds.
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  8265
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8266
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8267
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8268
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8269
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8270
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8271
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8272
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8273
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8274
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8275
    (visualType == #StaticGray
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  8276
     or:[ visualType == #GrayScale]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8277
        hasColors := false.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8278
        monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8279
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8280
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8281
    ncells == 2 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8282
        hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8283
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8284
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8285
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8286
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8287
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8288
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8289
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8290
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8291
    visualType == #TrueColor ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8292
        redShift := redMask lowBit - 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8293
        greenShift := greenMask lowBit - 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8294
        blueShift := blueMask lowBit - 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8295
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8296
        bitsRed := redMask highBit - redMask lowBit + 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8297
        bitsGreen := greenMask highBit - greenMask lowBit + 1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8298
        bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8299
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8300
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  8301
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8302
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8303
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8304
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8305
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8306
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8307
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8308
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8309
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8310
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8311
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8312
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8313
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8314
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8315
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8316
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8317
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8318
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8319
         * look for RGB visual
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8320
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8321
        nvi = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8322
        viproto.screen = scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8323
        vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8324
        maxRGBDepth = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8325
        for (i = 0; i < nvi; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8326
            switch (vip[i].class) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8327
                case TrueColor:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8328
                    if (vip[i].depth > maxRGBDepth) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8329
                        maxRGBDepth = vip[i].depth;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8330
                        rgbRedMask = vip[i].red_mask;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8331
                        rgbGreenMask = vip[i].green_mask;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8332
                        rgbBlueMask = vip[i].blue_mask;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8333
                        rgbVisualID = vip[i].visualid;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8334
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8335
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8336
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8337
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8338
        if (vip) XFree ((char *) vip);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8339
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8340
        if (maxRGBDepth) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8341
            __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8342
        }
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  8343
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  8344
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8345
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8346
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8347
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8348
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8349
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
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8352
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8353
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8354
    ignoreBackingStore := false.
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
    (self serverVendor = 'X11/NeWS') ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8357
        "/
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8358
        "/ this is a kludge around a bug in the X11/NeWS server,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8359
        "/ which does not correctly handle saveUnder
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8360
        "/
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8361
        hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8362
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8363
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8364
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8365
initializeUniqueID
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8366
    uniqueDeviceID isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8367
        uniqueDeviceID := UUID genUUID.
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8368
    ]
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8369
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8370
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8371
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8372
    "open a connection to some display;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  8373
     return the displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8374
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  8375
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8376
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8377
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8378
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8379
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  8380
    if (__isStringLike(dpyName))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8381
        nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8382
    else {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8383
        nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8384
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8385
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8386
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8387
    if (dpy) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8388
        static int firstCall = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8389
        OBJ dpyID;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8390
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8391
        dpyID = __MKEXTERNALADDRESS(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8392
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8393
        if (firstCall) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8394
            firstCall = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8395
            XSetErrorHandler(__XErrorHandler__);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8396
            XSetIOErrorHandler(__XIOErrorHandler__);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8397
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8398
        RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8399
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8400
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8401
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8402
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  8403
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8404
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8405
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8406
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8407
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8408
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8409
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8410
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8411
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8412
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8413
        RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8414
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8415
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8416
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8417
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8418
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8419
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8420
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8421
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8422
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8423
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8424
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8425
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8426
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8427
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8428
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8429
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8430
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8431
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8432
        RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8433
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8434
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8435
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8436
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8437
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8438
     Display queryCells
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8439
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8440
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8441
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8442
queryDPSExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8443
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8444
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8445
#ifdef DPS
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8446
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8447
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8448
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8449
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8450
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8451
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8452
        if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8453
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8454
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8455
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8456
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8457
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8458
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8459
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8460
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8461
     Display queryDPSExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8462
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8463
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8464
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8465
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8466
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8467
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8468
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8469
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8470
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8471
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8472
        RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8473
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8474
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8475
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8476
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8477
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8478
     Display queryDefaultScreen
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8479
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8480
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8481
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8482
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8483
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8484
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8485
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8486
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8487
        Visual *visual;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8488
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8489
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8490
        visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8491
        switch (visual->class) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8492
            case StaticGray:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8493
                RETURN ( @symbol(StaticGray) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8494
            case GrayScale:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8495
                RETURN ( @symbol(GrayScale) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8496
            case StaticColor:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8497
                RETURN ( @symbol(StaticColor) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8498
            case PseudoColor:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8499
                RETURN ( @symbol(PseudoColor) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8500
            case TrueColor:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8501
                RETURN ( @symbol(TrueColor) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8502
            case DirectColor:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8503
                RETURN ( @symbol(DirectColor) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8504
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8505
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8506
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8507
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8508
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8509
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8510
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8511
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8512
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8513
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8514
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8515
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8516
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8517
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8518
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8519
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8520
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8521
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8522
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8523
        RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8524
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8525
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8526
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8527
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8528
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8529
     Display queryDepth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8530
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8531
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8532
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8533
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8534
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8535
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8536
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8537
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8538
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8539
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8540
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8541
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8542
        RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8543
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8544
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8545
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8546
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8547
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8548
     Display queryHeight
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8549
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8550
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8551
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8552
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8553
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8554
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8555
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8556
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8557
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8558
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8559
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8560
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8561
        RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8562
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8563
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8564
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8565
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8566
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8567
     Display queryHeightMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8568
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8569
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8570
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8571
queryMBUFExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8572
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8573
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8574
#ifdef MBUF
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8575
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8576
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8577
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8578
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8579
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8580
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8581
        if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8582
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8583
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8584
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8585
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8586
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8587
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8588
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8589
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8590
     Display queryMBUFExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8591
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8592
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8593
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8594
queryPEXExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8595
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8596
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8597
#ifdef PEX5
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8598
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8599
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8600
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8601
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8602
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8603
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8604
        if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8605
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8606
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8607
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8608
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8609
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8610
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8611
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8612
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8613
     Display queryPEXExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8614
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8615
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8616
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8617
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8618
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8619
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8620
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8621
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8622
        Visual *visual;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8623
        OBJ redMask, greenMask, blueMask, bprgb;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8624
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8625
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8626
        visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8627
        redMask   = __MKSMALLINT(visual->red_mask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8628
        greenMask = __MKSMALLINT(visual->green_mask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8629
        blueMask  = __MKSMALLINT(visual->blue_mask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8630
        bprgb  = __MKSMALLINT(visual->bits_per_rgb);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8631
        RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8632
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8633
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8634
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8635
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8636
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8637
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8638
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8639
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8640
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8641
querySHMExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8642
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8643
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8644
#ifdef xxSHM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8645
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8646
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8647
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8648
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8649
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8650
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8651
        if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8652
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8653
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8654
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8655
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8656
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8657
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8658
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8659
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8660
     Display querySHMExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8661
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8662
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8663
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8664
queryShapeExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8665
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8666
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8667
#ifdef SHAPE
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8668
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8669
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8670
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8671
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8672
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8673
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8674
        if (XShapeQueryExtension(dpy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8675
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8676
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8677
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8678
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8679
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8680
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8681
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8682
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8683
     Display queryShapeExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8684
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8685
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8686
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8687
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8688
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8689
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8690
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8691
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8692
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8693
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8694
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8695
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8696
        RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8697
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8698
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8699
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8700
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8701
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8702
     Display queryWhitePixel
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8703
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8704
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8705
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8706
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8707
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8708
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8709
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8710
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8711
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8712
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8713
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8714
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8715
        RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8716
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8717
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8718
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8719
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8720
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8721
     Display queryWidth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8722
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8723
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8724
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8725
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8726
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8727
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8728
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8729
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8730
        int scr;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8731
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8732
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8733
        scr = DefaultScreen(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8734
        RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8735
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8736
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8737
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8738
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8739
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8740
     Display queryWidthMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8741
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8742
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8743
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8744
queryXIEExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8745
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8746
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8747
#ifdef XIE
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8748
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8749
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8750
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8751
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8752
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8753
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8754
        if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8755
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8756
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8757
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8758
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8759
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8760
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8761
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8762
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8763
     Display queryXIEExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8764
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8765
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8766
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8767
queryXIExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8768
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8769
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8770
#ifdef XI
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8771
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8772
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8773
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8774
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8775
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8776
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8777
        if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8778
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8779
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8780
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8781
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8782
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8783
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8784
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8785
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8786
     Display queryXIExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8787
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8788
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8789
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8790
queryXVideoExtension
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8791
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8792
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8793
#ifdef XVIDEO
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8794
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8795
        Display *dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8796
        int dummy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8797
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8798
        dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8799
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8800
        if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8801
            RETURN ( true );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8802
        }
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8803
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8804
#endif
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8805
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8806
    ^ false
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8807
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8808
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8809
     Display queryXVideoExtension
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8810
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8811
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  8812
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8813
queryXineramaExtension
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8814
%{  /* NOCONTEXT */
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8815
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8816
#ifdef XINERAMA
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8817
    if (ISCONNECTED) {
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8818
        Display *dpy;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8819
        int dummy;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8820
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8821
        dpy = myDpy;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8822
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8823
        if (XineramaQueryExtension (dpy, &dummy, &dummy)) {
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8824
            RETURN ( true );
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8825
        }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8826
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8827
#endif
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8828
%}.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8829
    ^ false
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8830
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8831
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8832
     Display queryXineramaExtension
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8833
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8834
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  8835
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8836
reinitialize
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8837
    preWaitAction notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8838
        Processor removePreWaitAction:preWaitAction.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8839
        preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8840
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8841
    virtualRootId := rootId := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8842
    selectionFetchers := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8843
    super reinitialize.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8844
    dispatchingExpose := nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8845
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8846
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8847
releaseDeviceResources
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8848
    preWaitAction notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8849
        Processor removePreWaitAction:preWaitAction.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8850
        preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8851
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8852
    selectionFetchers := nil.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  8853
    super releaseDeviceResources.
295
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8856
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8857
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8858
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8859
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8860
     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
  8861
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8862
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8863
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8864
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8865
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8866
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8867
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8868
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8869
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8870
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8871
     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
  8872
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8873
     and the setting can be changed with:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8874
        Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8875
     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
  8876
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8877
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8878
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8879
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8880
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8881
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8882
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8883
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8884
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8885
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8886
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8887
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  8888
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8889
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8890
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8891
     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
  8892
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8893
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8894
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8895
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8896
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8897
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8898
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8899
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8900
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8901
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8902
     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
  8903
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8904
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8905
     be changed with:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8906
        Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8907
     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
  8908
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8909
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8910
     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
  8911
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8912
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8913
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8914
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8915
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8916
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8917
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8918
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8919
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8920
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8921
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8922
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8923
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8924
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8925
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8926
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8927
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8928
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8929
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8930
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8931
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8932
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8933
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8934
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8935
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8936
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8937
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8938
    "return the Xlib mask bit for the 3rd modifier key.
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8939
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8940
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8941
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8942
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8943
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8944
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8945
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8946
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8947
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8948
    "return the Xlib mask bit for the 4th modifier key.
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8949
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8950
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8951
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8952
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8953
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8954
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8955
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8956
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8957
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8958
    "return the Xlib mask bit for the 5th modifier key.
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8959
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8960
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8961
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8962
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8963
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8964
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8965
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8966
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8967
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8968
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8969
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8970
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8971
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8972
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8973
    modifierKeyMap := self rawModifierMapping.
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
  8974
    modifierKeyMap isEmptyOrNil ifTrue:[^ nil].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8975
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8976
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8977
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8978
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8979
    1 to:8 do:[ :i |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8980
        (modifierKeyMap at:nextKey) ~= 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8981
            |mod|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8982
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8983
            mod := OrderedCollection new:maxKeyPerMod.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8984
            modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8985
                key ~= 0 ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8986
                    mod add:key
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8987
                ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8988
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8989
            ret at:i put:mod.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8990
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8991
        nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8992
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8993
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8994
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8995
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  8996
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8997
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8998
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  8999
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9000
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9001
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9002
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9003
     mapping := Display modifierMapping.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9004
     ^ mapping collect:[:eachRow |
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9005
                             eachRow notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9006
                                 eachRow collect:[ :key | Display stringFromKeycode:key ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9007
                             ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9008
                                 nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9009
                             ]
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9010
                       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9011
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9012
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9013
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9014
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9015
    "Get the raw keyboard mapping (maps some special X-keySyms to STX-internal names
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9016
     and can also be used to untranslate a stupid x-mapping (as on hpux)."
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9017
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9018
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9019
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9020
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9021
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9022
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9023
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9024
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9025
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9026
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9027
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9028
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
  9029
    |modifierKeyMap|
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9030
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9031
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9032
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9033
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9034
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9035
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9036
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9037
        if ((modmap = XGetModifierMapping(dpy)) != 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9038
           modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9039
           if (modifierKeyMap != nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9040
                memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9041
                       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9042
           }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9043
           XFreeModifiermap(modmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9044
        }
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9045
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9046
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9047
    ^ modifierKeyMap
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9048
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9049
    "
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9050
        Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9051
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9052
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9053
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9054
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9055
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9056
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9057
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9058
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9059
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9060
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9061
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9062
stringFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9063
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9064
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9065
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9066
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9067
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9068
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9069
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9070
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9071
    if (ISCONNECTED
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9072
     && __isSmallInteger(code)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9073
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9074
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9075
        if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol &&
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9076
            (keystring = XKeysymToString(keysym)) != 0)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9077
            str = __MKSTRING(keystring);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9078
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9079
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9080
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9081
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9082
    "
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9083
        Display stringFromKeycode:28
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9084
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9085
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9086
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9087
superModifierMask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9088
    "return the Xlib mask bit for the super modifier key"
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9089
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9090
    ^ self modifier4Mask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9091
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9092
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9093
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9094
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9095
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9096
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9097
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  9098
    UserPreferences current beepEnabled ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9099
        self beep:0 volume:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9100
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  9101
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  9102
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9103
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9104
5247
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
  9105
beep:aSymbolOrInteger volume:volumeInPercent
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
  9106
    "output an audible beep. aSymbolOrInteger determines the sound, but is ignored here
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
  9107
     (kept for comaptibilty with WinWorkstation)."
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9108
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9109
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9110
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9111
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9112
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9113
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9114
     && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9115
        /* stupid: X wants -100 .. 100 and calls this percent */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9116
        volume = __intVal(volumeInPercent) * 2 - 100;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9117
        if (volume < -100) volume = -100;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9118
        else if (volume > 100) volume = 100;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9119
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9120
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9121
        XBell(myDpy, volume);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9122
        LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9123
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9124
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9125
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9126
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9127
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9128
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9129
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9130
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9131
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9132
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9133
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9134
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9135
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9136
        XSynchronize(myDpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9137
        LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9138
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9139
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9140
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9141
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9142
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9143
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9144
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9145
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9146
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9147
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9148
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9149
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9150
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9151
     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
  9152
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9153
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9154
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9155
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9156
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9157
        XFlush(myDpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9158
        LEAVE_XLIB();
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9159
    }
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9160
%}
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9161
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  9162
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9163
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9164
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9165
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9166
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9167
    if (ISCONNECTED
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9168
        && __isExternalAddress(aDPSContext)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9169
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9170
        DPSFlushContext(__DPSContextVal(aDPSContext));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9171
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9172
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9173
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9174
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9175
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9176
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9177
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9178
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9179
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9180
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9181
    "send all buffered drawing to the display AND wait until the display
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9182
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9183
     This is almost never needed, except if you are about to read previously
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9184
     drawn pixels back from the display screen, or you want to wait for a beep
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9185
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9186
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9187
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9188
%{
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9189
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9190
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9191
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9192
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9193
        XSync(myDpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9194
        LEAVE_XLIB();
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9195
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9196
    }
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9197
%}
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9198
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9199
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9200
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9201
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9202
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9203
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9204
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9205
    if (ISCONNECTED && __isByteArrayLike(eB)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9206
        ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9207
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9208
        XRefreshKeyboardMapping(ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9209
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9210
        RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9211
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9212
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9213
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9214
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9215
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9216
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9217
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9218
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9219
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9220
    self sync.
4119
a770b7e08c72 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4114
diff changeset
  9221
    ^ Timestamp millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9222
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9223
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9224
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9225
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9226
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
  9227
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9228
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  9229
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  9230
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  9231
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9232
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9233
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9234
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9235
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9236
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9237
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9238
     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
  9239
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9240
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9241
     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
  9242
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9243
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9244
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9245
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9246
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9247
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9248
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9249
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9250
        if (__isExternalAddress(aWindowId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9251
            focusWindow = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9252
        } else if (aWindowId == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9253
            focusWindow = None;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9254
        } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9255
            goto err;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9256
        if (revertSymbol == @symbol(parent))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9257
            arg = RevertToParent;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9258
        else if (revertSymbol == @symbol(root))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9259
            arg = RevertToPointerRoot;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9260
        else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9261
            arg = RevertToNone;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9262
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9263
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9264
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9265
        XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9266
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9267
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9268
        RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9269
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9270
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9271
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9272
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9273
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9274
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9275
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9276
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9277
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9278
     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
  9279
     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
  9280
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9281
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9282
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
  9283
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9284
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9285
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9286
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9287
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9288
     This makes all graphics synchronous and turns off any buffering
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9289
     (i.e. each individual draw-request is sent immediately without
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9290
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9291
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9292
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  9293
     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
  9294
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9295
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9296
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9297
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9298
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9299
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9300
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9301
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9302
        XSynchronize(myDpy, 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9303
        LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9304
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9305
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9306
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  9307
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  9308
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  9309
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9310
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9311
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9312
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9313
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9314
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9315
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9316
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9317
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9318
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9319
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9320
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9321
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9322
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9323
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9324
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9325
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9326
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9327
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9328
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9329
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9330
     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
  9331
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9332
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9333
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9334
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  9335
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9336
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9337
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9338
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9339
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9340
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9341
        Display *dpy = myDpy;
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  9342
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9343
        w = RootWindow(dpy, screen);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9344
        if (w) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9345
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9346
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9347
            XQueryPointer(dpy, w, &rootRet, &childRet,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9348
                                 &rootX, &rootY,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9349
                                 &winX, &winY,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9350
                                 &mask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9351
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9352
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9353
            RETURN (__MKSMALLINT(mask));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9354
        }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9355
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9356
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9357
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9358
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9359
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9360
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9361
     Display buttonStates
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9362
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9363
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9364
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9365
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9366
     Display buttonStates bitTest:(Display controlMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9367
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9368
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9369
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9370
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9371
     Display buttonStates bitTest:(Display altModifierMask)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9372
     Display buttonStates bitTest:(Display metaModifierMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9373
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9374
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9375
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9376
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9377
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9378
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9379
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9380
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9381
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9382
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9383
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9384
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9385
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9386
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9387
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9388
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9389
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9390
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9391
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9392
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9393
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9394
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9395
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9396
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9397
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9398
pointerPosition
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9399
    "return the current pointer position in (virtual) root-window coordinates"
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9400
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9401
    <context: #return>
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9402
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9403
    |xpos ypos rootWindowId|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9404
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9405
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9406
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9407
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  9408
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9409
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9410
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9411
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9412
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9413
    if (ISCONNECTED && rootWindowId != nil) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9414
        Display *dpy = myDpy;
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9415
        Window w = (Window)__externalAddressVal(rootWindowId);
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9416
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9417
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9418
        XQueryPointer(dpy, w, &rootRet, &childRet,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9419
                              &rootX, &rootY,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9420
                              &winX, &winY,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9421
                              &mask);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9422
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9423
        xpos = __MKSMALLINT(rootX);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9424
        ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9425
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9426
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9427
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9428
    xpos isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9429
        self primitiveFailedOrClosedConnection.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9430
        ^ nil
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9431
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9432
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9433
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9434
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9435
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9436
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9437
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9438
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9439
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9440
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9441
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9442
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9443
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9444
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9445
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9446
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9447
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9448
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9449
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9450
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9451
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9452
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9453
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9454
    "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
  9455
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  9456
     Be careful with this - its usually not very ergonomically
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9457
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9458
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9459
     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
  9460
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9461
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9462
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9463
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9464
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9465
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9466
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9467
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9468
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9469
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9470
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9471
     && __bothSmallInteger(xpos, ypos)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9472
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9473
        Window w = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9474
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9475
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9476
        XWarpPointer(dpy,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9477
                     None,  /* src window */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9478
                     w,  /* dst window */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9479
                     0,  /* src_x */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9480
                     0,  /* src_y */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9481
                     0,  /* src_w */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9482
                     0,  /* src_h */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9483
                     __intVal(xpos),  /* dst_x */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9484
                     __intVal(ypos)   /* dst_y */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9485
                    );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9486
        LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9487
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9488
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9489
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9490
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9491
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9492
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  9493
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9494
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9495
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9496
!XWorkstation methodsFor:'private'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9497
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9498
findSelectionFetcher:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9499
    "find the SelectionFetcher that receives selection events for aDrawableId.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9500
     Answer nil, if there is none"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9501
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9502
    selectionFetchers isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9503
        ^ nil.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9504
    ].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9505
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  9506
    ^ selectionFetchers detect:[:eachFetcher|
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9507
            eachFetcher matchesDrawableId:aDrawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9508
    ] ifNone:[].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9509
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9510
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9511
registerSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9512
    "register a SelectionFetcher that receives selection events for aDrawableId"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9513
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9514
    selectionFetchers isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9515
        selectionFetchers := OrderedCollection new.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9516
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9517
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9518
    selectionFetchers add:aSelectionFetcher.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9519
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9520
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9521
unregisterSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9522
    "unregister a SelectionFetcher that received selection events for aDrawableId"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9523
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9524
    selectionFetchers remove:aSelectionFetcher.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9525
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9526
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9527
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9528
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9529
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9530
    "delete a property in the XServer"
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9531
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9532
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9533
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9534
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9535
    if (ISCONNECTED && __isAtomID(propertyID)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9536
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9537
        Atom prop;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9538
        Window window;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9539
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9540
        prop = __AtomVal(propertyID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9541
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9542
        if (__isExternalAddress(aWindowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9543
            window = __WindowVal(aWindowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9544
        } else if (aWindowID == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9545
            window = DefaultRootWindow(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9546
        } else if (__isInteger(aWindowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9547
            window = (Window)__unsignedLongIntVal(aWindowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9548
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9549
            goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9550
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9551
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9552
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9553
        XDeleteProperty(dpy, window, prop);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9554
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9555
        RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9556
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  9557
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9558
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9559
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9560
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9561
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9562
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9563
    "get a property as an association propertyType->propertyValue"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9564
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9565
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9566
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9567
    |val typeID propertyID windowID|
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9568
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9569
    propertySymbolOrAtomID isString ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9570
        propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9571
        propertyID isNil ifTrue:[^ nil].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9572
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9573
        propertyID := propertySymbolOrAtomID.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9574
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9575
    aWindowOrWindowIDOrNil isView ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9576
        windowID := aWindowOrWindowIDOrNil id.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9577
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9578
        windowID := aWindowOrWindowIDOrNil.
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9579
    ].
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
  9580
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9581
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9582
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9583
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9584
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9585
    Atom actual_type;
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  9586
    int actual_format;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9587
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9588
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9589
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9590
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9591
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9592
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9593
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9594
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9595
        if (__isAtomID(propertyID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9596
            property = __AtomVal(propertyID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9597
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9598
            if (__isExternalAddress(windowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9599
                window = __WindowVal(windowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9600
            } else if (windowID == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9601
                window = DefaultRootWindow(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9602
            } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9603
                goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9604
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9605
            nread = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9606
            cp = 0;
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9607
#ifdef PROPERTY_DEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9608
            console_fprintf(stderr, "getProperty %x\n", property);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9609
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9610
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9611
            do {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9612
                int retVal;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9613
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9614
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9615
                retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9616
                                            doDelete == true,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9617
                                            AnyPropertyType, &actual_type, &actual_format,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9618
                                            &nitems, &bytes_after, (unsigned char **)&data);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9619
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9620
                if (retVal != Success) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9621
#ifdef PROPERTY_DEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9622
                    console_fprintf(stderr, "- no success\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9623
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9624
                    ok = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9625
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9626
                }
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9627
#ifdef PROPERTY_DEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9628
                console_fprintf(stderr, "- type:%x\n", actual_type);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9629
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9630
                nitems *= (actual_format / 8);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9631
                typeID = __MKATOMOBJ(actual_type);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9632
                if (! cp) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9633
                    cp = cp2 = (char *)malloc(nitems+bytes_after);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9634
                } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9635
                    cp2 = cp + nread;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9636
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9637
                if (! cp) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9638
                    XFree(data);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9639
                    goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9640
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9641
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9642
                nread += nitems;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9643
                bcopy(data, cp2, nitems);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9644
                XFree(data);
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9645
#ifdef PROPERTY_DEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9646
                console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9647
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9648
            } while (bytes_after > 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9649
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9650
            if (ok) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9651
                switch (actual_format) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9652
                case 32:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9653
                    val = __stArrayFromCUIntArray(cp, nread/4);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9654
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9655
                case 16:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9656
                    val = __stArrayFromCUShortArray(cp, nread/2);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9657
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9658
                case 8:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9659
                default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9660
                    if (actual_type == XA_STRING) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9661
                        val = __MKSTRING_L(cp, nread);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9662
                    } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9663
                        val = __MKBYTEARRAY(cp, nread);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9664
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9665
                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9666
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9667
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9668
            if (cp)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9669
                free(cp);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9670
        }
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9671
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9672
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9673
%}.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
  9674
    (typeID isNil or:[typeID == 0]) ifTrue:[
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
  9675
        "typeID == 0 (None): The property does not exist in the specified window"
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9676
        ^ nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9677
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9678
    ^ typeID->val
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9679
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
  9680
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9681
     Display
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9682
        getProperty:#'_NET_WM_ICON_GEOMETRY'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9683
        from:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9684
        delete:false
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
  9685
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9686
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9687
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9688
propertiesOf:aWindowOrWindowIDOrNil
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9689
    "return a collection of all properties' atomIDs of a window.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9690
     Returns the rootWindows props for a nil window argument."
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9691
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9692
    <context: #return>
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9693
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9694
    |windowID atoms|
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9695
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9696
    aWindowOrWindowIDOrNil isView ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9697
        windowID := aWindowOrWindowIDOrNil id.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9698
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9699
        windowID := aWindowOrWindowIDOrNil.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9700
    ].
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9701
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9702
%{
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9703
    Window window;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9704
    Atom *atomListPtr;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9705
    int i;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9706
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9707
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9708
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9709
        int numProps = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9710
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9711
        if (__isExternalAddress(windowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9712
            window = __WindowVal(windowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9713
        } else if (windowID == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9714
            window = DefaultRootWindow(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9715
        } else if (__isInteger(windowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9716
            window = (Window)__unsignedLongIntVal(windowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9717
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9718
            goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9719
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9720
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9721
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9722
        atomListPtr = XListProperties(dpy, window, &numProps);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9723
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9724
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9725
        if (atomListPtr == NULL) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9726
            RETURN (nil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9727
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9728
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9729
        atoms = __ARRAY_NEW_INT(numProps);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9730
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9731
        if (atoms == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9732
            goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9733
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9734
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9735
        for (i=0; i<numProps; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9736
            OBJ atm;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9737
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9738
            atm = __MKATOMOBJ(atomListPtr[i]);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9739
            __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9740
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9741
        XFree(atomListPtr);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9742
        RETURN (atoms);
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9743
    }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9744
fail: ;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9745
%}.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9746
    ^ self primitiveFailed
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9747
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9748
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9749
     Display propertiesOf:nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9750
     Display propertiesOf:Transcript view id
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9751
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9752
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9753
     (Display propertiesOf:nil) do:[:atm |
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9754
        |v prop|
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9755
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9756
        Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9757
        Transcript show:': '.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9758
        prop := Display getProperty:atm from:nil delete:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  9759
        Transcript showCR:prop value.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9760
     ]
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9761
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9762
!
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
  9763
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9764
setIcon:anIcon for:aWindowID
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9765
    |iconAtom typeAtom buffer iWidth iHeight|
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9766
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9767
    iconAtom := self atomIDOf:#'_NET_WM_ICON' create:false.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9768
    iconAtom isNil ifTrue:[
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9769
        "/Hmm, no such property, not running under EWMH compliant WM?
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9770
        ^ self
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9771
    ].
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9772
    typeAtom := self atomIDOf:#'CARDINAL' create:false.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9773
    typeAtom isNil ifTrue:[
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9774
        "/Hmm, no such property, not running under EWMH compliant WM?
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9775
        ^ self
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9776
    ].
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9777
    iWidth  := anIcon width.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9778
    iHeight := anIcon height.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9779
    buffer := IntegerArray new:(iWidth*iHeight+2).
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9780
    buffer at:1 put:iWidth.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9781
    buffer at:2 put:iHeight.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9782
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9783
    self setProperty:iconAtom type:typeAtom value:buffer for:aWindowID
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9784
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9785
    "
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9786
        Display setIcon:0 for:0
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9787
    "
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9788
!
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
  9789
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9790
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9791
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9792
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9793
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  9794
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9795
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9796
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9797
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9798
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9799
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9800
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9801
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9802
        Atom prop, type;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9803
        Window window;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9804
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9805
        prop = __AtomVal(propertyID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9806
        type = __AtomVal(typeID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9807
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9808
        if (__isExternalAddress(aWindowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9809
            window = __WindowVal(aWindowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9810
        } else if (aWindowID == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9811
            window = DefaultRootWindow(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9812
        } else if (__isInteger(aWindowID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9813
            window = (Window)__unsignedLongIntVal(aWindowID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9814
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9815
            RETURN(false);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9816
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9817
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9818
        retval = true;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9819
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9820
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9821
        if (__isInteger(anObject)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9822
            unsigned INT value = __longIntVal(anObject);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9823
            XChangeProperty(dpy, window, prop, type, 32,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9824
                            PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9825
                            (unsigned char *)&value, 1);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9826
        } else if (__isByteArrayLike(anObject)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9827
            XChangeProperty(dpy, window, prop, type, 8,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9828
                            PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9829
                            __byteArrayVal(anObject),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9830
                            __byteArraySize(anObject));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9831
        } else if (__isWords(anObject)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9832
            /* wordArray-like (16bit-string) object */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9833
            XChangeProperty(dpy, window, prop, type, 16,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9834
                            PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9835
                            __stringVal(anObject),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9836
                            __wordArraySize(anObject));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9837
        } else if (__isIntegerArray(anObject)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9838
            /* array of atoms */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9839
            XChangeProperty(dpy, window, prop, type, 32,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9840
                            PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9841
                            (char *)__integerArrayVal(anObject),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9842
                            __integerArraySize(anObject));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9843
        } else if (__isStringLike(anObject)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9844
            XChangeProperty(dpy, window, prop, type, 8,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9845
                            PropModeReplace,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9846
                            __stringVal(anObject),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9847
                            __stringSize(anObject));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9848
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9849
            retval = false;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9850
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9851
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9852
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9853
        DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type));
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9854
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9855
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9856
    ^ retval
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9857
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9858
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9859
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9860
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9861
defaultExtentForTopViews
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9862
    "redefined, to define the default extent for the default monitor"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9863
    |extent|
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9864
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9865
    "the standard monitor is the first entry in monitorBounds"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9866
    extent := self monitorBounds first extent.
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9867
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9868
    self isPDA ifTrue:[
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9869
        ^ extent - (16 @ 20)
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9870
    ].
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9871
    ^ extent * 2 // 3
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9872
!
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
  9873
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9874
isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9875
%{  /* NOCONTEXT */
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9876
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9877
#ifdef XINERAMA
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9878
    if (ISCONNECTED) {
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9879
        Display *dpy;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9880
        dpy = myDpy;
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9881
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9882
        if (XineramaIsActive(dpy)) {
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9883
            RETURN ( true );
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9884
        }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9885
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9886
#endif
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9887
%}.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9888
    ^ false
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9889
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9890
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9891
     Display isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9892
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9893
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  9894
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9895
supportedClipboards
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9896
    "answer a collection of symbols with the supported clipboards.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9897
     X11 additionaly supports a buffer containing the currently selected text
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9898
     (in xterm) - the PRIMARY selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9899
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9900
    ^ #(clipboard selection)
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9901
!
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9902
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9903
supportsUTF8WindowLabels
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9904
    "answer true, if window labels are to be utf-8 encoded"
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9905
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
  9906
    ^ false
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9907
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  9908
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9909
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9910
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9911
atomIDOf:aStringOrSymbol
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  9912
    "return an X11 atoms ID.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9913
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9914
     The default is to create the atom, if it does not exist, in order to
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9915
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9916
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9917
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9918
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9919
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9920
     Display atomIDOf:#'FACE_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9921
     Display atomIDOf:#'FULL_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9922
     Display atomIDOf:#DndProtocol
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9923
     Display atomIDOf:#DndSelection
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9924
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9925
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  9926
    "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
  9927
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9928
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9929
atomIDOf:aStringOrSymbol create:create
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9930
    "return an Atoms ID given its name.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9931
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9932
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
  9933
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9934
     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
  9935
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9936
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9937
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9938
    atomSymbol := aStringOrSymbol asSymbol.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9939
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9940
        ^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9941
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9942
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9943
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9944
    atom notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9945
        atoms isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9946
            atoms := IdentityDictionary new.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9947
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9948
        atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9949
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9950
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9951
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9952
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9953
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9954
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
  9955
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9956
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9957
     Display atomIDOf:'PRIMARY' create:false
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9958
     Display atomIDOf:'blabla' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9959
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9960
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9961
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9962
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9963
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9964
     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
  9965
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9966
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  9967
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9968
%{
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9969
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9970
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9971
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9972
    if (ISCONNECTED && __isAtomID(anAtomID)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9973
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9974
        name = XGetAtomName(myDpy, __AtomVal(anAtomID));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9975
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9976
        if (name == 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9977
            RETURN (nil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9978
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9979
        str = __MKSTRING(name);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9980
        XFree(name);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  9981
        RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9982
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9983
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9984
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9985
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9986
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9987
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9988
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9989
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9990
     Display atomName:132  'FONTNAME_REGISTRY'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9991
     Display atomName:135 'FOUNDRY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9992
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9993
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9994
     Display atomName:152 'CHARSET_ENCODING'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9995
     Display atomName:154
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9996
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9997
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  9998
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9999
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10000
    "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
 10001
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10002
     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
 10003
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10004
     Notice:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10005
        we do not plan to use X's resources for ST/X's defaults,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10006
        styles or resources. This would make porting of applications
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10007
        to different platforms much more difficult (Windows has no resource
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10008
        database). If you stay within ST/X's resource files, these can be
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10009
        easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10010
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10011
     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
 10012
     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
 10013
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10014
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10015
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10016
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10017
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10018
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 10019
     && __isStringLike(name)
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 10020
     && __isStringLike(cls)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10021
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10022
        rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10023
                                  (char *) __stringVal(name));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10024
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10025
        RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10026
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10027
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10028
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10029
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10030
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10031
    "if your ~/.Xdefaults contains an entry such as:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10032
        OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10033
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10034
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10035
         Display getResource:'Beep' class:'OpenWindows'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10036
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10037
     if your ~/.Xdefaults contains an entry such as:
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10038
        *.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10039
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10040
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10041
         Display getResource:'beNiceToColormap' class:'any'
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10042
         Display getResource:'beNiceToColormap' class:''
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10043
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10044
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10045
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10046
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10047
    "return an Atoms ID; if create is true, create it if not already present.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10048
     This is highly X specific and only for local use (with selections)."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10049
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10050
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10051
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10052
%{
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10053
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10054
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10055
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 10056
     && __isStringLike(aStringOrSymbol)) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10057
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10058
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10059
        prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10060
                                  (create == true) ? False : True);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10061
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10062
        if (prop == None) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10063
            RETURN (nil);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10064
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10065
        RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10066
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10067
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10068
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10069
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10070
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10071
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10072
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10073
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10074
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10075
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10076
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10077
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10079
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10080
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
 10081
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
 10082
    "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
 10083
     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
 10084
     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
 10085
     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
 10086
     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
 10087
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 10088
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10089
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10090
    ((w <= 0) or:[h <= 0]) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10091
        self primitiveFailed.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10092
        ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10093
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10094
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 10095
    rawInfo := Array new:8.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10096
                  "1 -> bit order"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10097
                  "2 -> depth"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10098
                  "3 -> bytes_per_line"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10099
                  "4 -> byte_order"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10100
                  "5 -> format"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10101
                  "6 -> bitmap_unit"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10102
                  "7 -> bitmap_pad"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10103
                  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10104
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10105
    "/ 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
 10106
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10107
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10108
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 10109
    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10110
        info := IdentityDictionary new.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10111
        info at:#bitOrder put:(rawInfo at:1).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10112
        info at:#depth put:(rawInfo at:2).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10113
        info at:#bytesPerLine put:(rawInfo at:3).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10114
        info at:#byteOrder put:(rawInfo at:4).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10115
        info at:#format put:(rawInfo at:5).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10116
        info at:#bitmapUnit put:(rawInfo at:6).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10117
        info at:#bitmapPad put:(rawInfo at:7).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10118
        info at:#bitsPerPixel put:(rawInfo at:8).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10119
        ^ info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10120
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10121
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10122
     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
 10123
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10124
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10125
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10126
    ^ nil
295
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
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
 10129
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
 10130
    "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
 10131
     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
 10132
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10133
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 10134
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10135
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10136
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 10137
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10138
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10139
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10140
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10141
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 10142
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 10143
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10144
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10145
        xpos = __intVal(x);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10146
        ypos = __intVal(y);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10147
        if ((xpos < 0) || (ypos < 0)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10148
            RETURN ( __MKSMALLINT(0) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10149
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10150
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10151
        img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10152
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10153
        if (img != 0) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10154
            ret = XGetPixel(img, 0, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10155
            XDestroyImage(img);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10156
            RETURN (  __MKSMALLINT(ret) );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10157
        }
295
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
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10160
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10161
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10162
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10163
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10164
    "since XGetImage may allocate huge amount of stack space
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10165
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10166
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10167
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 10168
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10169
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10170
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 10171
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10172
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10173
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10174
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10175
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10176
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10177
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10178
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10179
     && __isArray(info)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10180
     && __isByteArray(imageBits)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10181
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10182
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10183
        win = __WindowVal(aDrawableId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10184
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10185
        image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10186
                                    __intVal(w), __intVal(h),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10187
                                    (unsigned)AllPlanes, ZPixmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10188
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10189
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10190
        if (! image) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10191
            RETURN ( false );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10192
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10193
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10194
        pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10195
#ifdef SUPERDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10196
        console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10197
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10198
        switch (image->depth) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10199
            case 1:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10200
            case 2:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10201
            case 4:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10202
            case 8:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10203
            case 16:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10204
            case 24:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10205
            case 32:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10206
                numBytes = image->bytes_per_line * image->height;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10207
                break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10208
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10209
            default:
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10210
                /* unsupported depth ? */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10211
                console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10212
                numBytes = image->bytes_per_line * image->height;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10213
                break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10214
        }
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
#ifdef SUPERDEBUG
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10217
        console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10218
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10219
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10220
        if (numBytes > __byteArraySize(imageBits)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10221
            /* imageBits too small */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10222
            console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10223
            console_fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10224
            console_fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n",
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10225
                                image->bitmap_pad, image->depth, image->bytes_per_line);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10226
            goto fail;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10227
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10228
        if (image->bitmap_bit_order == MSBFirst)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10229
            __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10230
        else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10231
            __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10232
        __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10233
        __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10234
        if (image->byte_order == MSBFirst)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10235
            __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10236
        else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10237
            __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10238
        if (image->format == XYBitmap)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10239
            __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10240
        else if (image->format == XYPixmap)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10241
            __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10242
        else if (image->format == ZPixmap)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10243
            __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10244
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10245
        __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10246
        __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10247
        __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10248
        bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10249
        XDestroyImage(image);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10250
        RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10251
    }
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10252
fail:
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10253
    if (image) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10254
        XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10255
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10256
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10257
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10258
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10259
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10260
!XWorkstation methodsFor:'selection fetching'!
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 10261
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10262
addSelectionHandler:someone
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10263
    "register someone to be notified when the selection changes"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10264
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10265
    selectionHandlers isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10266
        selectionHandlers := IdentitySet new.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10267
    ].
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10268
    selectionHandlers add:someone
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10269
!
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10270
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 10271
getClipboardObjectFor:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10272
    "get the object selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10273
     Returns nil, if no selection is available.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10274
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10275
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10276
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10277
    |selectionOwnerWindowId selection|
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10278
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10279
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10280
    selectionOwnerWindowId isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10281
        "no selection. There is the possibilty that one of our (modal)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10282
         views has been closed. Get the selection from the copyBuffer"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10283
        ^ copyBuffer.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10284
    ].
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10285
    selectionOwnerWindowId = selectionOwner ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10286
        "I still hold the selection, so return my locally buffered data"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10287
        ^ copyBuffer
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 10288
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 10289
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 10290
    drawableId notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10291
        "sorry, cannot fetch a selection, if there is now drawableId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10292
         Should I borrow a drawableId from another window?"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10293
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10294
        selection := SelectionFetcher
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10295
            requestSelection:clipboardAtom
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10296
            type:(self atomIDOf:#'ST_OBJECT')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10297
            onDevice:self for:drawableId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10298
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10299
        selection isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10300
            selection := SelectionFetcher
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10301
                requestSelection:clipboardAtom
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10302
                type:(self atomIDOf:#'UTF8_STRING')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10303
                onDevice:self for:drawableId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10304
        ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10305
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10306
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10307
    ^ selection.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10308
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10309
    "
5928
a06ebbe0d07a comment/format in: #getClipboardObjectFor:
Stefan Vogel <sv@exept.de>
parents: 5914
diff changeset
 10310
       Display getClipboardObjectFor:Transcript id
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10311
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10312
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10313
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 10314
getClipboardText:selectionBufferSymbol for:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10315
    "get the text selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10316
     Returns nil, if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10317
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10318
    |selectionId selectionOwnerWindowId selection|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10319
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10320
    selectionBufferSymbol == #selection ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10321
        selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10322
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10323
        selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10324
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10325
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10326
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10327
    selectionOwnerWindowId isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10328
        "no selection. There is the possibilty that one of our (modal)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10329
         views has been closed. Get the selection from the copyBuffer"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10330
        ^ self copyBufferAsString.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10331
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10332
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10333
    selectionOwnerWindowId = selectionOwner ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10334
        "I still hold the selection, so return my locally buffered data"
5899
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10335
        "JV@2012-04-02: Added support for PRIMARY/SELECTION buffers."
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10336
        ^ selectionId == primaryAtom ifTrue:[
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10337
            self primaryBufferAsString
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10338
        ] ifFalse:[
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10339
            self copyBufferAsString.
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10340
        ]
4845
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 10341
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 10342
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 10343
    drawableId notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10344
        "sorry, cannot fetch a selection, if there is now drawableId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10345
         Should I borrow a drawableId from another window?"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10346
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10347
        selection := SelectionFetcher
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10348
            requestSelection:selectionId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10349
            type:(self atomIDOf:#'UTF8_STRING')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10350
            onDevice:self for:drawableId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10351
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10352
        selection isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10353
            selection := SelectionFetcher
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10354
                requestSelection:selectionId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10355
                type:(self atomIDOf:#STRING)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10356
                onDevice:self for:drawableId.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10357
        ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10358
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10359
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10360
    ^ selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10361
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10362
     "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10363
       Display getTextSelection:#clipboard for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10364
       Display getTextSelection:#selection for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10365
     "
5899
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10366
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 10367
    "Modified: / 02-04-2012 / 10:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10368
!
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10369
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10370
removeSelectionHandler:someone
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10371
    "no longer tell someone about selection changes"
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10372
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10373
    selectionHandlers notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10374
        selectionHandlers remove:someone ifAbsent:nil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10375
        selectionHandlers isEmpty ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10376
            selectionHandlers := nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10377
        ]
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10378
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10379
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10380
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10381
!XWorkstation methodsFor:'selection sending'!
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10382
4282
b487fe05c51d Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents: 4280
diff changeset
 10383
copyBufferAs:aTargetAtom
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10384
    "convert the current selection to the format defined by aTargetAtom.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10385
     Answer the converted selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10386
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10387
    (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10388
        "the other view wants the selection as string"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10389
        ^ self copyBufferAsString.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10390
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10391
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10392
    (aTargetAtom == (self atomIDOf:#UTF8_STRING)) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10393
        "the other view wants the selection as utf8 string"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10394
        ^ self copyBufferAsString utf8Encoded.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10395
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10396
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10397
    (aTargetAtom == (self atomIDOf:#TIMESTAMP)) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10398
        "the other view wants to know when we acquired ownership of the selection"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10399
        ^ selectionTime.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10400
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10401
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10402
    (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10403
        "the other view wants to know which targets we support"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10404
        ^ self supportedTargetAtoms.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10405
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10406
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10407
    (aTargetAtom == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10408
        "send the selection in binaryStore format"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10409
        "require libboss to be loaded"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10410
        (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[^ nil].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10411
        ^ self getCopyBuffer binaryStoreBytes.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10412
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10413
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10414
    aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10415
        "the other one wants to know the size of our selection.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10416
         LENGTH is deprecated, since we do not know how the selection is
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10417
         going to be converted. The client must not rely on the length returned"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10418
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10419
        ^ self copyBufferAsString size
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10420
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10421
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10422
    "we do not support the requestet target type"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10423
    ^ nil.
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 10424
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 10425
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10426
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10427
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10428
primaryBufferAs:aTargetAtom
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10429
    "convert the current selection to the format defined by aTargetAtom.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10430
     Answer the converted selection"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10431
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10432
    (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10433
        "the other view wants the selection as string"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10434
        ^ self primaryBufferAsString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10435
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10436
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10437
    (aTargetAtom == (self atomIDOf:#UTF8_STRING)) ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10438
        "the other view wants the selection as utf8 string"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10439
        ^ self primaryBufferAsString utf8Encoded.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10440
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10441
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10442
    (aTargetAtom == (self atomIDOf:#TIMESTAMP)) ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10443
        "the other view wants to know when we acquired ownership of the selection"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10444
        ^ selectionTime.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10445
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10446
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10447
    (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10448
        "the other view wants to know which targets we support"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10449
        ^ self supportedTargetAtoms copyWithoutFirst "/we do not support ST_OBJECT in primary
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10450
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10451
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10452
    aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10453
        "the other one wants to know the size of our selection.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10454
         LENGTH is deprecated, since we do not know how the selection is
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10455
         going to be converted. The client must not rely on the length returned"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10456
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10457
        ^ self primaryBufferAsString size
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10458
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10459
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10460
    "we do not support the requestet target type"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10461
    ^ nil.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10462
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10463
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10464
    "Created: / 27-03-2012 / 14:49:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10465
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10466
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 10467
setClipboardObject:anObject owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10468
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10469
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10470
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10471
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10472
    selectionTime := lastEventTime.
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10473
    self setSelectionOwner:aWindowId of:clipboardAtom time:selectionTime
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10474
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10475
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 10476
setClipboardText:aString owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10477
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10478
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10479
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10480
     We set both the PRIMARY and CLIPBOARD, so that you can paste
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10481
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10482
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10483
    selectionTime := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10484
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10485
    self setSelectionOwner:aWindowId of:clipboardAtom time:selectionTime.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10486
    self setSelectionOwner:aWindowId of:primaryAtom time:selectionTime.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10487
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10488
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10489
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10490
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10491
setPrimaryText:aString owner:aWindowId
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10492
    "set the PRIMARY selection, and make aWindowId be the owner.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10493
     This can be used by any other X application when middle-click
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10494
     pasting. X Window specific."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10495
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10496
    selectionTime := lastEventTime.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10497
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10498
    self setSelectionOwner:aWindowId of:primaryAtom time:selectionTime.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10499
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10500
    "Created: / 27-03-2012 / 14:16:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10501
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 10502
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10503
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10504
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10505
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10506
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10507
    |supportedTargets numericTargetArray|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10508
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 10509
    supportedTargets := #(ST_OBJECT STRING UTF8_STRING TIMESTAMP TARGETS LENGTH).
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10510
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10511
    numericTargetArray := IntegerArray new:supportedTargets size.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10512
    supportedTargets keysAndValuesDo:[:index :targetSymbol|
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10513
        numericTargetArray at:index put:(self atomIDOf:targetSymbol)
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10514
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10515
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10516
    ^ numericTargetArray
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10517
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10518
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10519
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10520
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10521
getSelectionOwnerOf:selectionAtomSymbolOrID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10522
    "get the owner of a selection, aDrawableID.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10523
     Answer nil, if there is no owner"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10524
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10525
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10526
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10527
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10528
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10529
    selectionAtomSymbolOrID isString ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10530
        selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10531
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10532
        selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10533
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10534
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10535
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10536
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10537
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10538
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10539
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10540
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10541
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10542
        window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10543
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10544
        RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10545
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10546
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10547
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10548
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10549
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10550
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 10551
requestSelection:selectionID type:typeID for:aWindowId intoProperty:propertyID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10552
    "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
 10553
     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
 10554
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10555
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10556
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10557
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10558
    |anIntegerTimestamp|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10559
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10560
    anIntegerTimestamp := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10561
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10562
%{
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10563
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10564
    if (ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10565
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 10566
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10567
     && __isAtomID(selectionID)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10568
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10569
        Window w;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10570
        Time time;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10571
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10572
        if (__isExternalAddress(aWindowId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10573
            w = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10574
        } else if (aWindowId == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10575
            w = (Window)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10576
        } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10577
            goto err;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10578
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10579
        if (anIntegerTimestamp == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10580
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10581
             * the ICCCM convention says: you should set the time to the time when
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10582
             * the selection was requested and not to CurrentTime
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10583
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10584
            time = CurrentTime;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10585
        } else if (__isInteger(anIntegerTimestamp)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10586
            time = __unsignedLongIntVal(anIntegerTimestamp);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10587
        } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10588
            goto err;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10589
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10590
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10591
        XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10592
                               __AtomVal(propertyID), w, time);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10593
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10594
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10595
        RETURN (true);
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10596
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10597
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10598
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10599
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10600
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10601
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10602
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10603
     Display
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10604
        requestSelection:(Display atomIDOf:'PRIMARY')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10605
        property:(Display atomIDOf:'VT_SELECTION')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10606
        type:(Display atomIDOf:'STRING')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10607
        for:Transcript id
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10608
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 10609
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10610
     Display
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10611
        requestSelection:(Display atomIDOf:'PRIMARY')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10612
        property:(Display atomIDOf:'VT_SELECTION')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10613
        type:(Display atomIDOf:'C_STRING')
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10614
        for:Transcript id
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10615
    "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10616
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10617
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 10618
sendNotifySelection:selectionID property:propertyID target:targetID time:aTime to:requestorID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10619
    "send a selectionNotify back from a SelectionRequest.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10620
     PropertyID should be the same as requested  or nil, if the selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10621
     could not be converted.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10622
     TargetId should be the same as requested.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10623
     Time should be the time when the selection has been acquired"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10624
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10625
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10626
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10627
    if (ISCONNECTED
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10628
        && (__isAtomID(propertyID) || propertyID == nil)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10629
        && __isAtomID(targetID) && __isAtomID(selectionID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10630
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10631
        XEvent ev;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10632
        Window requestor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10633
        Status result;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10634
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10635
        if (__isExternalAddress(requestorID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10636
            requestor = __WindowVal(requestorID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10637
        } else if (__isSmallInteger(requestorID)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10638
            requestor = (Window)__smallIntegerVal(requestorID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10639
        } else if (requestorID == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10640
            requestor = DefaultRootWindow(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10641
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10642
            requestor = (Window)__unsignedLongIntVal(requestorID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10643
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10644
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10645
        ev.xselection.type = SelectionNotify;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10646
        ev.xselection.display = dpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10647
        ev.xselection.selection = __AtomVal(selectionID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10648
        ev.xselection.target = __AtomVal(targetID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10649
        ev.xselection.requestor = requestor;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10650
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10651
        if (__isExternalAddress(aTime)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10652
            ev.xselection.time = (INT)(__externalAddressVal(aTime));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10653
        } else if (__isSmallInteger(aTime)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10654
            ev.xselection.time = __smallIntegerVal(aTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10655
        } else if (aTime == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10656
            ev.xselection.time = CurrentTime;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10657
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10658
            ev.xselection.time = (INT)__unsignedLongIntVal(aTime);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10659
        }
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 10660
#if 0
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10661
        console_printf("ev.xselection.selection: %x\n", ev.xselection.selection);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10662
        console_printf("ev.xselection.target: %x\n", ev.xselection.target);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10663
        console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10664
        console_printf("ev.xselection.time: %x\n", ev.xselection.time);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10665
        console_printf("requestor: %x\n", requestor);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10666
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10667
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10668
        /* send nil property if selection cannot be converted */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10669
        if (propertyID == nil)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10670
            ev.xselection.property = None;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10671
        else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10672
            ev.xselection.property = __AtomVal(propertyID);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10673
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10674
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10675
        DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10676
                ev.xselection.selection,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10677
                ev.xselection.property,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10678
                ev.xselection.target,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10679
                ev.xselection.requestor,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10680
                requestor));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10681
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10682
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10683
        result = XSendEvent(dpy, requestor, False, 0 , &ev);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10684
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10685
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10686
        if ((result == BadValue) || (result == BadWindow)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10687
            DPRINTF(("bad status\n"));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10688
            RETURN (false);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10689
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10690
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10691
        XFlush(dpy);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10692
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10693
        RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10694
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10695
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10696
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 10697
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10698
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10699
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10700
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10701
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10702
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID time:anIntegerTimestamp
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10703
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10704
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10705
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10706
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10707
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10708
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10709
    "store the current owner of the selection.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10710
     If we still own the selection on paste,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10711
     we can avoid the X11 overhead"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10712
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10713
    selectionOwner := aWindowId.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10714
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10715
    selectionAtomSymbolOrID isString ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10716
        selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10717
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10718
        selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10719
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10720
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10721
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10722
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10723
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10724
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10725
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10726
     && ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10727
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10728
        Time time;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10729
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10730
        win = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10731
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10732
        if (anIntegerTimestamp == nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10733
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10734
             * the ICCCM convention says: you should set the time to the time when
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10735
             * the selection was acquired and not to CurrentTime
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10736
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10737
            time = CurrentTime;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10738
        } else if (__isInteger(anIntegerTimestamp)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10739
            time = __unsignedLongIntVal(anIntegerTimestamp);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10740
        } else
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10741
            goto err;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10742
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10743
        DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10744
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10745
        XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10746
        RETURN (self);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10747
        LEAVE_XLIB();
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10748
    }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10749
err:;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 10750
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10751
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10752
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10753
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10754
!XWorkstation methodsFor:'window queries'!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10755
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10756
allChildIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10757
    "return all children-ids of the given window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10758
     Allows for all windows to be enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10759
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10760
    |childIDs allChildIDs|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10761
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10762
    allChildIDs := OrderedCollection new.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10763
    childIDs := self childIdsOf:aWindowId.
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
 10764
    childIDs notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10765
        allChildIDs addAll:childIDs.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10766
        childIDs do:[:eachChildId |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10767
            allChildIDs addAll:(self allChildIdsOf:eachChildId).
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10768
        ].
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10769
    ].
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10770
    ^ allChildIDs
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10771
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10772
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10773
     Display allChildIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10774
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10775
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10776
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10777
     |deviceIDAtom uuidAtom|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10778
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10779
     deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10780
     uuidAtom     := (Display atomIDOf:#'UUID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10781
     (Display allChildIdsOf:(Display rootWindowId))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10782
        select:[:id |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10783
            |uuid|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10784
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10785
            Display
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10786
                getProperty:deviceIDAtom
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10787
                from:id
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10788
                delete:false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10789
                into:[:type :value |
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10790
                    type == uuidAtom ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10791
                        uuid := UUID fromBytes:value.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10792
                    ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10793
                ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10794
            uuid notNil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10795
        ]
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10796
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10797
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10798
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10799
childIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10800
    "return all children-ids of the given window. Allows for all windows to be
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10801
     enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10802
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10803
    |childIdArray|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10804
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10805
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10806
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10807
    if (ISCONNECTED
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10808
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10809
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10810
        Window win = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10811
        Window rootReturn, parentReturn;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10812
        Window* children = (Window *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10813
        unsigned int numChildren;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10814
        int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10815
        int rslt;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10816
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10817
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10818
        rslt = XQueryTree(dpy, win,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10819
                       &rootReturn, &parentReturn,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10820
                       &children, &numChildren);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10821
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10822
        if (rslt) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10823
            childIdArray = __ARRAY_NEW_INT(numChildren);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10824
            if (childIdArray != nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10825
                for (i=0; i < numChildren; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10826
                    if (children[i]) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10827
                        OBJ childId;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10828
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10829
                        childId = __MKEXTERNALADDRESS(children[i]);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10830
                        __ArrayInstPtr(childIdArray)->a_element[i] = childId;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10831
                        __STORE(childIdArray, childId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10832
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10833
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10834
                if (children) XFree(children);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10835
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10836
            RETURN (childIdArray);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10837
        }
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10838
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10839
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10840
    ^ nil.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10841
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10842
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10843
      Display childIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10844
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10845
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10846
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10847
realRootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10848
    "return the id of the real root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10849
     This may not be the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10850
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10851
     of it. Except for very special cases, use #rootWindowId, which takes
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10852
     care of any virtual root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10853
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10854
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10855
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10856
    Window root;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10857
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10858
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10859
    if (__INST(rootId) != nil) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10860
        RETURN (__INST(rootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10861
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10862
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10863
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10864
        root = RootWindow(myDpy, screen);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10865
        if (! root) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10866
            id = nil;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10867
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10868
            id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10869
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10870
        RETURN (id);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10871
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10872
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10873
    self primitiveFailedOrClosedConnection.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10874
    ^ nil
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10875
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10876
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10877
      Display rootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10878
      Display realRootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10879
    "
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10880
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10881
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10882
rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10883
    "return the id of the root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10884
     This is the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10885
     however, it may or may not be the real physical root window,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10886
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10887
     of the real one. If this is the case, that views id is returned here."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10888
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10889
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10890
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10891
    Window rootWin, vRootWin = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10892
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10893
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10894
    if (__INST(virtualRootId) != nil) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10895
        RETURN (__INST(virtualRootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10896
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10897
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10898
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10899
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10900
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10901
        rootWin = RootWindow(dpy, screen);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10902
#ifndef IRIS
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10903
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10904
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10905
         * on IRIS, this creates a badwindow error - why ?
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10906
         * children contains a funny window (000034)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10907
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10908
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10909
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10910
         * care for virtual root windows (tvtwm & friends)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10911
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10912
        {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10913
            Atom vRootAtom, kwinAtom;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10914
            int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10915
            Window rootReturn, parentReturn;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10916
            Window* children = (Window *)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10917
            unsigned int numChildren;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10918
            int ignoreVRoot = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10919
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10920
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10921
             * Take care of KDE 2.1.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10922
             * they define _SWM_ROOT but this is not the parent of
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10923
             * the application windows.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10924
             * Instead it is used for background painting
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10925
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10926
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10927
            kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10928
            if (kwinAtom != None) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10929
                Atom actual_type;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10930
                int actual_format;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10931
                unsigned long nitems, bytesafter;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10932
                unsigned char *retVal = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10933
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10934
                ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10935
                                       0L, 1L, False, kwinAtom,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10936
                                       &actual_type, &actual_format,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10937
                                       &nitems, &bytesafter, &retVal) == Success
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10938
                              && actual_type != 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10939
                if (retVal)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10940
                    XFree(retVal);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10941
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10942
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10943
            if (!ignoreVRoot) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10944
                vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10945
                if (vRootAtom != None) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10946
                    if (XQueryTree(dpy, rootWin,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10947
                                       &rootReturn, &parentReturn,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10948
                                       &children, &numChildren)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10949
                        for (i=0; i < numChildren; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10950
                            Atom actual_type;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10951
                            int actual_format;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10952
                            unsigned long nitems, bytesafter;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10953
                            Window* newRoot = (Window*) 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10954
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10955
                            if (children[i]) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10956
                                if (XGetWindowProperty(dpy, children[i], vRootAtom,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10957
                                                       0L, 1L, False, XA_WINDOW,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10958
                                                       &actual_type, &actual_format,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10959
                                                       &nitems, &bytesafter,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10960
                                                       (unsigned char**) &newRoot
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10961
                                                      ) == Success && newRoot) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10962
                                    vRootWin = *newRoot;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10963
                                    XFree(newRoot); /* XXX */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10964
                                    break;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10965
                                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10966
                            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10967
                        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10968
                        if (children) XFree(children);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10969
                    }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10970
                }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10971
             }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10972
        }
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10973
#endif
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10974
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10975
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10976
    if (! vRootWin) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10977
        vRootWin = rootWin;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10978
        if (! vRootWin) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10979
            RETURN ( nil );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10980
        }
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10981
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10982
    id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10983
    id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10984
    RETURN ( id );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10985
%}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10986
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10987
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10988
      Display rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10989
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10990
! !
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 10991
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10992
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10993
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10994
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10995
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10996
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10997
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10998
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10999
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11000
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11001
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11002
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11003
        if (__isExternalAddress(aWindowId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11004
         && __bothSmallInteger(x, y)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11005
         && __bothSmallInteger(width, height)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11006
            w = __intVal(width);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11007
            h = __intVal(height);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11008
            /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11009
             * need this check here: some servers simply dump core with bad args
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11010
             */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11011
            if ((w >= 0) && (h >= 0)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11012
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11013
                XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11014
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11015
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11016
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11017
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11018
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11019
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11020
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11021
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11022
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11023
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11024
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11025
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11026
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11027
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11028
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11029
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11030
        if (__isExternalAddress(aWindowId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11031
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11032
            XClearWindow(myDpy, __WindowVal(aWindowId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11033
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11034
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11035
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11036
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11037
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11038
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11039
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11040
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11041
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11042
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11043
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11044
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11045
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11046
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11047
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11048
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11049
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11050
    if (ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11051
        if (__isExternalAddress(aWindowId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11052
         && __isExternalAddress(siblingId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11053
            if (modeSymbol == @symbol(above)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11054
                chg.stack_mode = Above;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11055
            } else if (modeSymbol == @symbol(below)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11056
                chg.stack_mode = Below;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11057
            } else if (modeSymbol == @symbol(topIf)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11058
                chg.stack_mode = TopIf;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11059
            } else if (modeSymbol == @symbol(bottomIf)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11060
                chg.stack_mode = BottomIf;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11061
            } else if (modeSymbol == @symbol(opposite)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11062
                chg.stack_mode = Opposite;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11063
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11064
                mask = CWSibling;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11065
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11066
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11067
            chg.sibling = __WindowVal(siblingId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11068
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11069
            XConfigureWindow(myDpy, __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11070
                                    mask, &chg);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11071
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11072
            RETURN ( self );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11073
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11074
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11075
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11076
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11077
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11078
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11079
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11080
getGeometryOf:aWindowId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11081
    "get a windows geometry.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11082
     NOTICE: X-WindowManagers usually do wrap client topViews into their own
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11083
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11084
     Thus, the numbers returned here for topViews are the physical (real) dimensions
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11085
     relative to such a wrapper.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11086
     In contrast, the values found in the views instance variables are virtual dimensions
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11087
     (i.e. ST/X makes this decoration view transparent to the program."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11088
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11089
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11090
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11091
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11092
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11093
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11094
    int x_ret, y_ret;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11095
    unsigned int width_ret, height_ret,
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11096
                 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11097
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11098
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11099
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11100
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11101
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11102
        XGetGeometry(myDpy, __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11103
                     &root_ret,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11104
                     &x_ret, &y_ret,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11105
                     &width_ret, &height_ret, &border_width_ret,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11106
                     &depth_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11107
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11108
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11109
        x = __MKSMALLINT(x_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11110
        y = __MKSMALLINT(y_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11111
        width = __MKSMALLINT(width_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11112
        height = __MKSMALLINT(height_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11113
        depth = __MKSMALLINT(depth_ret);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11114
        borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11115
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11116
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11117
    borderWidth isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11118
        self primitiveFailedOrClosedConnection.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11119
        ^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11120
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11121
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11122
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11123
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11124
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11125
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11126
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11127
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11128
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11129
     Transcript topView device
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11130
        getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11131
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11132
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11133
     Transcript topView device
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11134
        getGeometryOf:(Transcript topView id)
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 11135
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 11136
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 11137
     Display
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11138
        getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11139
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11140
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11141
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11142
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11143
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11144
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11145
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11146
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11147
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11148
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11149
    "return true, if the given window ID is (still) valid.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11150
     Especially useful, if the passed windowID is
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11151
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11152
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11153
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11154
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11155
%{
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11156
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11157
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11158
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11159
        char *name = NULL;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11160
        Status ok;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11161
        Window root, parent, *children = NULL;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11162
        unsigned int nChildren;
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11163
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11164
/*        ENTER_XLIB(); */
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11165
        ok = XQueryTree(myDpy, __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11166
                        &root, &parent, &children, &nChildren);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11167
        if (children) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11168
            XFree(children);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11169
        }
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11170
/*        LEAVE_XLIB();   */
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11171
        if (ok) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11172
            RETURN (true);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11173
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11174
        RETURN (false);
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11175
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11176
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11177
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11178
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11179
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11180
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11181
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11182
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11183
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11184
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11185
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11186
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11187
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11188
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11189
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11190
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11191
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11192
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11193
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11194
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 11195
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11196
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11197
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11198
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11199
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11200
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11201
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11202
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11203
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11204
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11205
        XLowerWindow(myDpy, __WindowVal(aWindowId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11206
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11207
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11208
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11209
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11210
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11211
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11212
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11213
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11214
              width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 11215
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11216
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11217
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11218
    "make a window visible - either as icon or as a real view
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 11219
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 11220
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 11221
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11222
4480
3e1449309dfa Set icon mask in #mapWindow:....
Stefan Vogel <sv@exept.de>
parents: 4478
diff changeset
 11223
    |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11224
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11225
    aBoolean ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11226
        wicon := aView icon.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11227
        wicon notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11228
            wiconId := wicon id.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11229
            wicon mask notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11230
                iconMaskId := wicon mask id.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11231
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11232
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11233
        wiconView := aView iconView.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11234
        wiconView notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11235
            wiconViewId := wiconView id
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11236
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11237
        wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11238
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 11239
    minExt notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11240
        minW := minExt x.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11241
        minH := minExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 11242
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 11243
    maxExt notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11244
        maxW := maxExt x.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11245
        maxH := maxExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 11246
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11247
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11248
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11249
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11250
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11251
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11252
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11253
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11254
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11255
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11256
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11257
        win = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11258
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11259
        szhints.flags = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11260
        if (__bothSmallInteger(xPos, yPos)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11261
            szhints.x = __intVal(xPos);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11262
            szhints.y = __intVal(yPos);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11263
            szhints.flags |= USPosition;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11264
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11265
        if (__bothSmallInteger(w, h)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11266
            szhints.width = __intVal(w);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11267
            szhints.height = __intVal(h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11268
            szhints.flags |= USSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11269
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11270
        if (__bothSmallInteger(minW, minH)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11271
            szhints.flags |= PMinSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11272
            szhints.min_width = __intVal(minW);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11273
            szhints.min_height = __intVal(minH);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11274
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11275
        if (__bothSmallInteger(maxW, maxH)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11276
            szhints.flags |= PMaxSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11277
            szhints.max_width = __intVal(maxW);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11278
            szhints.max_height = __intVal(maxH);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11279
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11280
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11281
        if (aBoolean == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11282
            char *windowName = "";
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11283
            Pixmap iconBitmap = (Pixmap)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11284
            Pixmap iconMask = (Pixmap)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11285
            Window iconWindow = (Window)0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11286
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11287
            if (__isExternalAddress(wiconId))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11288
                iconBitmap = __PixmapVal(wiconId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11289
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11290
            if (__isExternalAddress(iconMaskId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11291
                iconMask = __PixmapVal(iconMaskId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11292
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11293
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11294
            if (__isExternalAddress(wiconViewId))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11295
                iconWindow = __WindowVal(wiconViewId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11296
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11297
            if (__isStringLike(wlabel))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11298
                windowName = (char *) __stringVal(wlabel);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11299
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11300
            if (iconBitmap || windowName) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11301
                ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11302
                XSetStandardProperties(dpy, win,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11303
                                        windowName, windowName,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11304
                                        iconBitmap,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11305
                                        0, 0, &szhints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11306
                LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11307
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11308
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11309
            wmhints.flags = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11310
            if (iconBitmap) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11311
                wmhints.flags |= IconPixmapHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11312
                wmhints.icon_pixmap = iconBitmap;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11313
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11314
            if (iconMask) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11315
                wmhints.flags |= IconMaskHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11316
                wmhints.icon_mask = iconMask;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11317
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11318
            if (iconWindow) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11319
                wmhints.flags |= IconWindowHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11320
                wmhints.icon_window = iconWindow;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11321
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11322
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11323
            wmhints.initial_state = IconicState;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11324
            wmhints.flags |= StateHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11325
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11326
            XSetWMHints(dpy, win, &wmhints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11327
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11328
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11329
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11330
        if (szhints.flags) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11331
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11332
            XSetNormalHints(dpy, win, &szhints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11333
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11334
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11335
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11336
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11337
        XMapWindow(dpy, win);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11338
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11339
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11340
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11341
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11342
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11343
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11344
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11345
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11346
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11347
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11348
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11349
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11350
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11351
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11352
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11353
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11354
        XMapWindow(myDpy, __WindowVal(aWindowId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11355
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11356
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11357
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11358
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11359
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11360
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11361
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11362
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11363
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11364
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11365
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11366
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11367
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11368
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11369
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11370
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11371
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11372
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11373
     && __bothSmallInteger(x, y)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11374
        newWidth = __intVal(w);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11375
        newHeight = __intVal(h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11376
        if (newWidth < 1) newWidth = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11377
        if (newHeight < 1) newHeight = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11378
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11379
        XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11380
                              __intVal(x), __intVal(y),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11381
                              newWidth, newHeight);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11382
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11383
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11384
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11385
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11386
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11387
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11388
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11389
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11390
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11391
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11392
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11393
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11394
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11395
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11396
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11397
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11398
        XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11399
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11400
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11401
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11402
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11403
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11404
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11405
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11406
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11407
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11408
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11409
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11410
%{
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11411
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11412
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11413
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11414
        Status ok;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11415
        Window root, parent, *children = NULL;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11416
        unsigned int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11417
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11418
/*        ENTER_XLIB(); */
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11419
        ok = XQueryTree(myDpy, __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11420
                        &root, &parent, &children, &nChildren);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11421
        if (children) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11422
            XFree(children);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11423
        }
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11424
/*        LEAVE_XLIB();   */
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11425
        if (! ok) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11426
            RETURN ( nil );
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11427
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11428
        RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11429
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11430
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11431
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11432
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11433
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11434
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11435
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11436
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11437
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11438
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11439
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11440
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 11441
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11442
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11443
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11444
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11445
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11446
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11447
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11448
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11449
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11450
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11451
        XRaiseWindow(myDpy, __WindowVal(aWindowId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11452
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11453
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11454
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11455
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11456
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11457
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11458
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11459
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11460
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11461
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11462
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11463
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11464
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11465
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11466
     && __isExternalAddress(newParentWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11467
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11468
        Window _child, _newParent;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11469
        int i;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11470
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11471
        _child = __WindowVal(windowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11472
        _newParent = __WindowVal(newParentWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11473
        ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11474
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11475
#if 0
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11476
        XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11477
        XSync (dpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11478
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11479
        /*
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11480
         * Code 'stolen' from xswallow source ...
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11481
         * ... mhmh - what is this loop for ?
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11482
         */
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11483
        for (i=0; i<5; i++) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11484
            XReparentWindow (dpy, _child, _newParent, 0, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11485
            XSync (dpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11486
        }
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 11487
#if 0
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11488
        XMapWindow (dpy, _child);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11489
        XSync (dpy, 0);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11490
#endif
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11491
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11492
        RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11493
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11494
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11495
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11496
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11497
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11498
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11499
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11500
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11501
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11502
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11503
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11504
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11505
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11506
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11507
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11508
        newWidth = __intVal(w);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11509
        newHeight = __intVal(h);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11510
        if (newWidth < 1) newWidth = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11511
        if (newHeight < 1) newHeight = 1;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11512
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11513
        XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11514
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11515
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11516
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11517
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11518
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11519
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11520
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11521
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11522
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11523
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11524
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11525
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11526
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11527
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11528
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11529
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11530
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11531
        if (__INST(ignoreBackingStore) != true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11532
            if (how == @symbol(always)) wa.backing_store = Always;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11533
            else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11534
            else if (how == true) wa.backing_store = Always;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11535
            else wa.backing_store = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11536
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11537
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11538
            XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11539
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11540
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11541
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11542
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11543
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11544
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11545
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11546
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11547
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11548
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11549
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11550
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11551
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11552
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11553
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11554
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11555
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11556
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11557
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11558
        if (how == @symbol(NorthWest)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11559
            wa.bit_gravity = NorthWestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11560
        } else if (how == @symbol(NorthEast)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11561
            wa.bit_gravity = NorthEastGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11562
        } else if (how == @symbol(SouthWest)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11563
            wa.bit_gravity = SouthWestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11564
        } else if (how == @symbol(SouthEast)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11565
            wa.bit_gravity = SouthEastGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11566
        } else if (how == @symbol(Center)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11567
            wa.bit_gravity = CenterGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11568
        } else if (how == @symbol(North)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11569
            wa.bit_gravity = NorthGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11570
        } else if (how == @symbol(South)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11571
            wa.bit_gravity = SouthGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11572
        } else if (how == @symbol(West)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11573
            wa.bit_gravity = WestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11574
        } else if (how == @symbol(East)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11575
            wa.bit_gravity = EastGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11576
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11577
            wa.bit_gravity = NorthWestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11578
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11579
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11580
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11581
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11582
        XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11583
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11584
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11585
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11586
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11587
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11588
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11589
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11590
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11591
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11592
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11593
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11594
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11595
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11596
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11597
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11598
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11599
     && __isExternalAddress(aCursorId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11600
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11601
        Window w = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11602
        Cursor c = __CursorVal(aCursorId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11603
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11604
        if (w && c) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11605
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11606
            XDefineCursor(dpy, w, c);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11607
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11608
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11609
        RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11610
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11611
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11612
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11613
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11614
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11615
setForegroundWindow:aWindowId
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11616
    "bring a window to front.
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11617
     Send a specific message to the WindowManager"
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11618
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11619
    |activeWindowAtom|
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11620
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11621
"/    self raiseWindow:aWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11622
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11623
    activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11624
    activeWindowAtom notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11625
        self
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11626
            sendClientEvent:activeWindowAtom
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11627
            format:32
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11628
            to:(self rootWindowId)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11629
            propagate:false
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11630
            eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11631
            window:aWindowId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11632
            data1:2                 "activate request from pager. This is a trick: kwm ignores requests from applications (1)"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11633
            data2:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11634
            data3:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11635
            data4:nil
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11636
            data5:nil.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11637
    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11638
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11639
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11640
      Transcript topView setForegroundWindow
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11641
    "
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11642
!
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11643
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11644
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11645
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11646
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11647
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11648
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11649
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11650
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11651
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11652
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11653
    utf8String := aString utf8Encoded.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11654
    aString bitsPerCharacter > 8 ifTrue:[
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11655
        "/ X does not like 2-byte labels ...
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11656
        simpleString := aString asSingleByteStringReplaceInvalidWith:$?
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 11657
    ] ifFalse:[
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11658
        simpleString := aString.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11659
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11660
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11661
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11662
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11663
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11664
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11665
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11666
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11667
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11668
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11669
        titleProperty.value =  __stringVal(utf8String);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11670
        titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11671
        titleProperty.format = 8;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11672
        titleProperty.nitems = __stringSize(utf8String);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11673
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11674
        ENTER_XLIB();
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11675
        XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11676
        /* alternative settings for UTF8-Strings */
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11677
        XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11678
        LEAVE_XLIB();
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11679
        RETURN ( self );
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11680
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11681
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 11682
    self primitiveFailedOrClosedConnection
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 11683
!
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 11684
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11685
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11686
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11687
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11688
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11689
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11690
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11691
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11692
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11693
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11694
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11695
        if (__INST(hasSaveUnder) == true) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11696
            wa.save_under = (yesOrNo == true) ? 1 : 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11697
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11698
            XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11699
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11700
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11701
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11702
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11703
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11704
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11705
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11706
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11707
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11708
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11709
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11710
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11711
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11712
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11713
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11714
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11715
        Window w;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11716
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11717
        if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11718
            w = (Window) 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11719
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11720
            if (__isExternalAddress(aMainWindowId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11721
                w = __WindowVal(aMainWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11722
            } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11723
                goto getOutOfHere;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11724
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11725
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11726
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11727
        XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11728
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11729
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11730
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 11731
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11732
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11733
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11734
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11735
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11736
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11737
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11738
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11739
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11740
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11741
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11742
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11743
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11744
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11745
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11746
     && __isSmallInteger(aColorIndex)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11747
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11748
        XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11749
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11750
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11751
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11752
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11753
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11754
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11755
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11756
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11757
    "set the windows background pattern to be a form.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11758
     This is the pattern with which the view is filled whenever exposed.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11759
     Do not confuse this with the background drawing color, which is used
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11760
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11761
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11762
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
 11763
%{  /* STACK: 64000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11764
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11765
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11766
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11767
     && __isExternalAddress(aPixmapId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11768
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11769
        XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11770
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11771
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11772
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11773
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11774
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11775
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11776
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11777
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11778
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11779
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11780
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11781
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11782
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11783
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11784
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11785
     && __isSmallInteger(aColorIndex)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11786
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11787
        XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11788
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11789
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11790
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11791
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11792
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11793
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11794
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11795
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11796
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11797
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11798
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11799
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11800
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11801
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11802
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11803
     && __isExternalAddress(aPixmapId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11804
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11805
        XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11806
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11807
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11808
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 11809
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11810
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11811
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11812
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11813
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11814
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11815
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11816
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11817
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11818
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11819
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11820
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11821
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11822
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11823
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11824
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11825
    if (__isExternalAddress(aPixmapId))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11826
        shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11827
    else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11828
        shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11829
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11830
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 11831
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11832
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11833
        XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11834
                          0, 0, shapeBitmap, ShapeSet);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11835
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11836
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11837
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11838
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11839
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11840
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11841
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11842
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11843
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11844
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11845
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11846
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11847
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11848
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11849
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11850
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11851
     && __isSmallInteger(aNumber)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11852
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11853
        XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11854
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11855
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11856
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11857
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11858
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11859
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11860
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11861
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
 11862
    "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
 11863
     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
 11864
     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
 11865
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11866
    <context: #return>
857
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11867
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11868
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11869
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11870
        XClassHint classhint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11871
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11872
        classhint.res_class = classhint.res_name = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11873
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11874
        if (__isStringLike(wClass)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11875
            classhint.res_class = (char *) __stringVal(wClass);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11876
        } else if (wClass != nil)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11877
            goto error;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11878
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11879
        if (__isStringLike(wName)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11880
            classhint.res_name = (char *) __stringVal(wName);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11881
        } else if (wName != nil)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11882
            goto error;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11883
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11884
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11885
        XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11886
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11887
        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
 11888
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11889
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11890
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11891
    self primitiveFailedOrClosedConnection
857
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11892
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 11893
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11894
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11895
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11896
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11897
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11898
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11899
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11900
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11901
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11902
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11903
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11904
        if (how == @symbol(NorthWest)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11905
            wa.win_gravity = NorthWestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11906
        } else if (how == @symbol(NorthEast)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11907
            wa.win_gravity = NorthEastGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11908
        } else if (how == @symbol(SouthWest)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11909
            wa.win_gravity = SouthWestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11910
        } else if (how == @symbol(SouthEast)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11911
            wa.win_gravity = SouthEastGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11912
        } else if (how == @symbol(Center)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11913
            wa.win_gravity = CenterGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11914
        } else if (how == @symbol(North)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11915
            wa.win_gravity = NorthGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11916
        } else if (how == @symbol(South)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11917
            wa.win_gravity = SouthGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11918
        } else if (how == @symbol(West)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11919
            wa.win_gravity = WestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11920
        } else if (how == @symbol(East)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11921
            wa.win_gravity = EastGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11922
        } else {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11923
            wa.win_gravity = NorthWestGravity;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11924
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11925
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11926
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11927
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11928
        XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11929
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11930
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11931
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11932
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11933
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11934
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11935
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11936
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11937
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11938
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11939
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11940
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11941
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11942
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11943
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11944
    aForm notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11945
        iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11946
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11947
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11948
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11949
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11950
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11951
        XWMHints hints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11952
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11953
        hints.icon_pixmap = __PixmapVal(iconId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11954
        hints.flags = IconPixmapHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11955
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11956
        XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11957
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11958
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11959
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11960
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11961
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11962
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11963
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11964
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11965
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11966
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11967
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11968
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11969
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11970
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11971
    aForm notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11972
        iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11973
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11974
    aMaskForm notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11975
        maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11976
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11977
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11978
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11979
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11980
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11981
        XWMHints hints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11982
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11983
        hints.icon_pixmap = __PixmapVal(iconId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11984
        hints.flags = IconPixmapHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11985
        if ((maskId != nil)
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11986
         && __isExternalAddress(maskId)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11987
            hints.icon_mask = __PixmapVal(maskId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11988
            hints.flags |= IconMaskHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11989
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11990
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11991
        XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11992
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 11993
        RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11994
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11995
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11996
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11997
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11998
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 11999
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12000
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12001
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12002
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12003
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12004
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12005
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12006
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12007
    aView notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12008
        iconWindowId := aView id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12009
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12010
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12011
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12012
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12013
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12014
        XWMHints wmhints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12015
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12016
        wmhints.icon_window = __WindowVal(iconWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12017
        wmhints.flags = IconWindowHint;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12018
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12019
        XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12020
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12021
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12022
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12023
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12024
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12025
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12026
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 12027
setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12028
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12029
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12030
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12031
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12032
%{
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12033
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12034
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12035
        Display *dpy = myDpy;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12036
        XSizeHints szhints;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12037
        Window win;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12038
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12039
        win = __WindowVal(aWindowId);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12040
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12041
        szhints.flags = 0;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12042
        if (__bothSmallInteger(minW, minH)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12043
            szhints.flags |= PMinSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12044
            szhints.min_width = __intVal(minW);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12045
            szhints.min_height = __intVal(minH);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12046
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12047
        if (__bothSmallInteger(maxW, maxH)) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12048
            szhints.flags |= PMaxSize;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12049
            szhints.max_width = __intVal(maxW);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12050
            szhints.max_height = __intVal(maxH);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12051
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12052
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12053
        if (szhints.flags) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12054
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12055
            XSetNormalHints(dpy, win, &szhints);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12056
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12057
        }
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12058
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12059
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12060
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12061
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12062
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12063
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12064
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12065
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12066
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12067
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12068
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12069
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12070
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12071
    utf8String := aString utf8Encoded.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12072
    aString bitsPerCharacter > 8 ifTrue:[
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12073
        "/ X does not like 2-byte labels ...
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12074
        simpleString := aString asSingleByteStringReplaceInvalidWith:$?
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 12075
    ] ifFalse:[
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12076
        simpleString := aString.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12077
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12078
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12079
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12080
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12081
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12082
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12083
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12084
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12085
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12086
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12087
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12088
        titleProperty.value =  __stringVal(utf8String);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12089
        titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12090
        titleProperty.format = 8;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12091
        titleProperty.nitems = __stringSize(utf8String);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12092
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12093
        ENTER_XLIB();
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12094
        XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12095
        /* alternative settings for UTF8-Strings */
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12096
        XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty);
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12097
        LEAVE_XLIB();
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12098
        RETURN ( self );
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12099
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12100
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12101
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12102
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12103
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12104
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12105
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12106
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 12107
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12108
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12109
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12110
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12111
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12112
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12113
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12114
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12115
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12116
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12117
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12118
    if (__isExternalAddress(aPixmapId))
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12119
        shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12120
    else
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12121
        shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12122
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12123
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12124
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12125
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12126
        XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12127
                          0, 0,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12128
                          shapeBitmap, ShapeSet);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12129
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12130
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12131
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12132
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12133
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12134
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12135
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12136
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12137
setWindowState:aSymbol in:aWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12138
    "tell the window type to the window manager.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12139
     Send a specific message to the WindowManager"
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12140
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12141
    |netWmWindowStateAtom stateAtom|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12142
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12143
    netWmWindowStateAtom := self atomIDOf:#'_NET_WM_WINDOW_STATE' create:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12144
    stateAtom := self atomIDOf:aSymbol create:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12145
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12146
    (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12147
        self
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12148
            sendClientEvent:netWmWindowStateAtom
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12149
            format:32
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12150
            to:(self rootWindowId)
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12151
            propagate:true
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12152
            eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12153
            window:aWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12154
            data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false)
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12155
            data2:stateAtom
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12156
            data3:nil
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12157
            data4:1
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12158
            data5:nil.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12159
    ] ifFalse:[self halt.].
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12160
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12161
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12162
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12163
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12164
      v := TopView new create.  
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12165
      Display setWindowState:#'_NET_WM_WINDOW_STATE_STICKY' in:v id.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12166
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12167
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12168
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12169
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12170
setWindowType:aSymbol in:aWindowId
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12171
    "Tell the window type to the window manager.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12172
     See Extended Window Manager Hints 1.3,
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12173
     chapter 'Application Window Properties'
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12174
     http://standards.freedesktop.org/wm-spec/1.3/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12175
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12176
    JV@2012-05-15: There was some code prior 2012-05-15,
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12177
    but that code does not work anymore and I wonder if it
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12178
    ever worked correctly. I changed it to be
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12179
    EWMH compatible, as this improve UX on modern Linxu
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12180
    machines. 
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12181
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12182
    It also helps to fix super-annoying problem with window autoraiser 
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12183
    on X11 in a proper way - window manager should manage top-level
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12184
    window stacking, that's why it is called a 'window manager' :-)
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12185
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12186
    "
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12187
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12188
    | nameAtom typeAtom valueAtom |
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12189
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12190
    self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12191
                  _NET_WM_WINDOW_TYPE_DOCK
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12192
                  _NET_WM_WINDOW_TYPE_TOOLBAR
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12193
                  _NET_WM_WINDOW_TYPE_MENU
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12194
                  _NET_WM_WINDOW_TYPE_UTILITY
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12195
                  _NET_WM_WINDOW_TYPE_SPLASH
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12196
                  _NET_WM_WINDOW_TYPE_DIALOG
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12197
                  _NET_WM_WINDOW_TYPE_NORMAL) includes: aSymbol).
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12198
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12199
    nameAtom := self atomIDOf:#'_NET_WM_WINDOW_TYPE' create:false.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12200
    nameAtom isNil ifTrue:[
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12201
        "/Hmm, no such property, not running under EWMH compliant WM?
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12202
        self breakPoint: #jv.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12203
        ^self
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12204
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12205
    "/ Hmm, hmm, no access to XA_ATOM, XA_INTEGER and so on...    
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12206
    typeAtom := self atomIDOf:#'ATOM' create:false.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12207
    typeAtom isNil ifTrue:[
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12208
        self error:'Oops, no ATOM atom'.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12209
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12210
    valueAtom := self atomIDOf: aSymbol create:false.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12211
    valueAtom isNil ifTrue:[
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12212
        "/Hmm, no such property, not running under EWMH compliant WM?
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12213
        self breakPoint: #jv.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12214
        ^self
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12215
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12216
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12217
    self setProperty: nameAtom type: typeAtom value: valueAtom for: aWindowId.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12218
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12219
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12220
"/   Original code that does not work (if ever worked)
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12221
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12222
"/    |netWmWindowTypeAtom typeAtom|
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12223
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12224
"/    netWmWindowTypeAtom := self atomIDOf:#'_NET_WM_WINDOW_TYPE' create:false.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12225
"/    typeAtom := self atomIDOf:aSymbol create:false.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12226
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12227
"/    (netWmWindowTypeAtom notNil and:[typeAtom notNil]) ifTrue:[
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12228
"/        self
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12229
"/            sendClientEvent:netWmWindowTypeAtom
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12230
"/            format:32
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12231
"/            to:(self rootWindowId)
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12232
"/            propagate:true
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12233
"/            eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12234
"/            window:aWindowId
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12235
"/            data1:typeAtom
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12236
"/            data2:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12237
"/            data3:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12238
"/            data4:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12239
"/            data5:nil.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12240
"/    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12241
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12242
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12243
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12244
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12245
      v := TopView new create.  
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12246
      Display setWindowType:#'_NET_WM_WINDOW_TYPE_DOCK' in:v id.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12247
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12248
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 12249
      |v|
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 12250
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 12251
      v := TopView new create.  
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 12252
      Display setWindowType:#'_NET_WM_WINDOW_TYPE_UTILITY' in:v id.
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 12253
      v open.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12254
    "
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12255
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 12256
    "Modified (comment): / 15-05-2012 / 10:49:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12257
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12258
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12259
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12260
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12261
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12262
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12263
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12264
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12265
     * ignore closed connection
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12266
     */
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12267
    if (! ISCONNECTED) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12268
        RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 12269
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 12270
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 12271
    if (__isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12272
        ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12273
        XUnmapWindow(myDpy, __WindowVal(aWindowId));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12274
        LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12275
        RETURN ( self );
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12276
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12277
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 12278
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12279
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12280
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12281
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12282
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12283
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12284
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12285
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12286
%{
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12287
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12288
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12289
     && __isExternalAddress(aWindowId)) {
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12290
        Atom JunkAtom;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12291
        int JunkInt;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12292
        unsigned long WinState,JunkLong;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12293
        unsigned char *Property;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12294
        Atom WM_STATE_Atom;
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12295
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12296
        if (__INST(wmStateAtom) != nil) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12297
            WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12298
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12299
            ENTER_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12300
            XGetWindowProperty(myDpy, __WindowVal(aWindowId),
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12301
                               WM_STATE_Atom,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12302
                               0L, 2L, False, AnyPropertyType,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12303
                               &JunkAtom,&JunkInt,&WinState,&JunkLong,
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12304
                               &Property);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12305
            LEAVE_XLIB();
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12306
            WinState=(unsigned long)(*((long*)Property));
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12307
            if (WinState==3) {
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12308
                RETURN (true);
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12309
            }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12310
        }
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12311
        RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12312
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12313
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12314
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12315
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12316
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12317
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12318
!XWorkstation::SelectionFetcher class methodsFor:'documentation'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12319
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12320
documentation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12321
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12322
    This class is responsible for fetching the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12323
    The X11 clipboard is implemented via asynchonous messages.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12324
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12325
    For each fetch operation an instance of this class is created.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12326
    The asynchronous messages are queued and executed in the
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12327
    process that requests the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12328
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12329
    [author:]
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12330
        Stefan Vogel (stefan@zwerg)
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12331
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12332
    [instance variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12333
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12334
    [class variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12335
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12336
    [see also:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12337
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12338
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12339
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12340
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12341
!XWorkstation::SelectionFetcher class methodsFor:'selections'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12342
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12343
requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12344
    ^ self new requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12345
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12346
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12347
!XWorkstation::SelectionFetcher methodsFor:'accessing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12348
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12349
getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12350
    "convert the data in buffer to a selection"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12351
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12352
    |selection|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12353
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12354
    buffer isNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12355
        ^ nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12356
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12357
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12358
    targetID == (display atomIDOf:#STRING) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12359
        display clipboardEncoding notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12360
            selection := buffer decodeFrom:display clipboardEncoding
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12361
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12362
        selection := buffer.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12363
    ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12364
"/ Transcript show:'UTF8: '; showCR:buffer storeString.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12365
        selection := CharacterArray fromUTF8Bytes:buffer
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12366
    ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12367
"/ Transcript show:'TEXT: '; showCR:buffer storeString.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12368
        selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12369
    ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12370
"/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12371
        selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12372
    ]]]].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12373
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12374
    selection notNil ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12375
        (selection endsWith:Character cr) ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12376
            selection := selection asStringCollection copyWith:''
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12377
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12378
        ^ selection.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12379
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12380
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 12381
    targetID == (display atomIDOf:#'TARGETS') ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12382
        ^ buffer
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 12383
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12384
    targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12385
        "require libboss to be loaded"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12386
        (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[^ nil].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12387
        ^ (Object readBinaryFrom:(ReadStream on:buffer) onError:[nil])
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12388
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12389
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12390
    'XWorkstation: unimplemented property targetID: ' infoPrint. (display atomName:targetID) infoPrint.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12391
    ' buffer:' infoPrint. buffer infoPrintCR.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12392
    ^ nil
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 12393
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 12394
    "Modified: / 23-08-2006 / 15:56:04 / cg"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12395
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12396
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12397
!XWorkstation::SelectionFetcher methodsFor:'event handling'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12398
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12399
message:aMessage
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12400
    "got an asynchronous event from the display.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12401
     Save and wake up waiters"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12402
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12403
    aMessage selector == #propertyChange:property:state:time: ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12404
        (aMessage arguments at:2) ~~ propertyID ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12405
            "I am only interested in changes of the property used to
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12406
             store the selection"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12407
            ^ self.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12408
        ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12409
        message notNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12410
            "this should not happen - bad selection holder?"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12411
            'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12412
            ^ self.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12413
        ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12414
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12415
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12416
    "we get a propertyChange before the selectionNotify.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12417
     Since the propertyChange will be ignored anyway (because we are not in incremental mod,
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12418
     a selectionNotify message may overwrite a propertyChange message"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12419
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12420
    message := aMessage.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12421
    sema signal.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12422
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12423
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12424
propertyChange:aView property:aPropertyId state:stateSymbol time:time
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12425
    "this is a forwarded propretyChange event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12426
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12427
    |property propertyValue|
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12428
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12429
    incremental ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12430
        "ignore property changes until we are in incremental mode"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12431
        ^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12432
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12433
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12434
    property := display getProperty:propertyID from:drawableID delete:true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12435
    propertyValue := property value.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12436
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12437
    propertyValue size == 0 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12438
        "property with size 0 signals end of transfer"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12439
        done := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12440
    ] ifFalse:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12441
        buffer isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12442
            targetID := property key.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12443
            buffer := propertyValue.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12444
        ] ifFalse:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12445
            targetID ~= property key ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12446
                'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12447
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12448
            buffer := buffer, propertyValue.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12449
        ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12450
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12451
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12452
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12453
selectionNotify:aView selection:aSelectionID target:aTargetID property:aPropertyID requestor:requestorID time:time
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12454
    "this is a forwarded selectionNotify event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12455
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12456
    |property propertyKey atomName|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12457
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12458
    aSelectionID ~~ selectionID ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12459
        "ignore notification that is not for our selection"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12460
        ^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12461
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12462
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12463
    aPropertyID == 0 ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12464
        "the selection owner could not convert the selection to our target type"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12465
        done := true.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12466
        ^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12467
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12468
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12469
    property := display getProperty:aPropertyID from:drawableID delete:true.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12470
    property isNil ifTrue:[
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12471
        "the property does not exist in the specified window"
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12472
        done := true.
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12473
        ^ self
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12474
    ].
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12475
        
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12476
    propertyKey := property key.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12477
    propertyKey == aTargetID ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12478
        "good, the property is consistent with our request.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12479
         The whole selection is in the property"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12480
        buffer := property value.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12481
        done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12482
    ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12483
        "this is an incremental transfer. Wait for property change"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12484
        incremental := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12485
    ] ifFalse:[
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12486
        atomName := (display atomName:propertyKey) ? propertyKey.
5901
5324f9088c88 comment/format in: #encodingOf:
Stefan Vogel <sv@exept.de>
parents: 5899
diff changeset
 12487
        'XWorkstation(error): unexpected targetID (' errorPrint.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12488
        atomName errorPrint.
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12489
        ') in selectionNotify: ' errorPrint.
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12490
        display errorPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12491
        done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12492
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12493
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12494
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12495
!XWorkstation::SelectionFetcher methodsFor:'selection actions'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12496
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12497
requestSelection:aSelectionId type:aTargetId onDevice:aDisplay for:aDrawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12498
    "request the selection of type targetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12499
     Wait for next asynchronous message and process it,
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12500
     until done"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12501
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12502
    display := aDisplay.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12503
    drawableID := aDrawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12504
    selectionID := aSelectionId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12505
    propertyID := display atomIDOf:#'VT_SELECTION'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12506
    targetID := aTargetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12507
    sema := Semaphore new name:'X11SelectionFetcher'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12508
    done := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12509
    incremental := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12510
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12511
    [
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12512
        |timeout|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12513
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12514
        display registerSelectionFetcher:self.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12515
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12516
        display
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12517
            requestSelection:aSelectionId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12518
            type:aTargetId
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12519
            for:drawableID
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12520
            intoProperty:propertyID.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12521
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12522
        timeout := display xlibTimeout.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12523
        [
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12524
            |currentMessage|
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12525
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12526
            (sema waitWithTimeout:timeout) isNil ifTrue:[
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12527
                "the selection owner didn't respond within reasonable time"
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12528
                'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12529
                ^ nil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12530
            ].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12531
            currentMessage := message.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12532
            message := nil.
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12533
            currentMessage notNil ifTrue:[currentMessage sendTo:self].
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12534
        ] doUntil:[done].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12535
    ] ensure:[
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12536
        display unregisterSelectionFetcher:self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12537
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12538
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12539
    ^ self getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12540
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12541
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12542
!XWorkstation::SelectionFetcher methodsFor:'testing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12543
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12544
matchesDrawableId:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12545
    "return true, if this SelectionFetcher fetches for aDrawableId"
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12546
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12547
    ^ drawableID = aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12548
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12549
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 12550
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12551
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 12552
version_CVS
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 12553
    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.546 2012-10-22 17:20:54 stefan Exp $'
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
 12554
!
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
 12555
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
 12556
version_SVN
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12557
    ^ '§ Id §'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12558
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 12559
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12560
XWorkstation initialize!