XWorkstation.st
author Claus Gittinger <cg@exept.de>
Thu, 18 Jan 2018 17:17:05 +0100
changeset 8259 9328dbbffcb9
parent 8225 88de54496ec6
child 8261 9874141ac064
permissions -rw-r--r--
#DOCUMENTATION by cg class: DisplaySurface comment/format in: #beepInEditor
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
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
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
6758
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
    14
"{ NameSpace: Smalltalk }"
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
    15
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    16
DeviceWorkstation subclass:#XWorkstation
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    17
	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    18
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    19
		hasImageExtension hasInputExtension hasXineramaExtension
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    20
		hasRenderExtension hasXftLibrary ignoreBackingStore blackpixel
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    21
		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    22
		quitAppAtom primaryAtom clipboardAtom stringAtom wmStateAtom
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    23
		motifWMHintsAtom listOfXFonts buttonsPressed eventRootX
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    24
		eventRootY displayName eventTrace dispatchingExpose rgbVisual
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    25
		rgbaVisual virtualRootId rootId altModifierMask metaModifierMask
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    26
		lastEventTime rawMonitorBounds monitorBounds lastButtonPressTime
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
    27
		lastButtonPressPosition deviceIOTimeoutErrorSignal
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
    28
		activateOnClick rawKeySymTranslation selectionOwner
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
    29
		clipboardSelectionTime primarySelectionTime selectionFetchers
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
    30
		selectionHandlers preWaitAction xlibTimeout
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    31
		xlibTimeoutForWindowCreation hasConnectionBroken uniqueDeviceID
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    32
		stxDeviceAtom uuidAtom primaryBuffer windowGroupWindow
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
    33
		maxOperationsUntilFlush operationsUntilFlush lastError'
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    34
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    35
		DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    36
		ErrorDBCache'
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    37
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    38
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    39
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    40
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    41
Object subclass:#PseudoDeviceWithoutXFTSupport
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    42
	instanceVariableNames:'realDevice'
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    43
	classVariableNames:''
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    44
	poolDictionaries:''
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    45
	privateIn:XWorkstation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    46
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    47
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    48
Object subclass:#SelectionFetcher
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    49
	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    50
		buffer done incremental'
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    51
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    52
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    53
	privateIn:XWorkstation
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    54
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    55
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    56
SimpleView subclass:#WindowGroupWindow
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    57
	instanceVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    58
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    59
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    60
	privateIn:XWorkstation
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    61
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    62
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
    63
DeviceGraphicsContext subclass:#X11GraphicsContext
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
    64
	instanceVariableNames:'depth xftDrawId'
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    65
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    66
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    67
	privateIn:XWorkstation
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
    68
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
    69
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    70
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    71
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    72
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    73
#define SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    74
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    75
#ifdef LINUX
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    76
# ifndef __arm__
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    77
#  define SHM
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    78
# endif
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    79
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    80
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    81
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    82
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    83
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    84
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    85
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    86
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    87
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    88
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    89
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    90
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    91
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    92
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    93
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    94
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    95
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    96
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    97
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    98
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    99
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   100
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   101
 * 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
   102
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   103
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   104
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   105
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   106
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   107
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   108
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   109
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   110
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   111
#include <stdio.h>
5989
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   112
6041
cd2da50a737c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   113
#if defined(__osx__)
5989
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   114
# include <malloc/malloc.h>
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   115
extern void *malloc();
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   116
#else
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   117
# ifndef FREEBSD
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   118
#  include <malloc.h>
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   119
# endif
5528
42447013fbc6 freebsd
Michael Beyl <mb@exept.de>
parents: 5525
diff changeset
   120
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   121
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   122
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   123
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   124
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   125
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   126
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   127
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   128
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   129
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   130
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   131
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   132
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   133
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   134
extern OBJ __GLOBAL_GET_BY_NAME(char *);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   135
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   136
# define __HANDLE_VAL(type, externalAddress) \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   137
	((type)__externalAddressVal(externalAddress))
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   138
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   139
# define __HANDLE_NEW(ptr, __cls)                    \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   140
	({                                           \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   141
	    OBJ handle = __MKEXTERNALADDRESS(ptr);   \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   142
	    OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   143
	    __InstPtr(handle)->o_class = clsObj;     \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   144
	    __STORE(handle, clsObj);                 \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   145
	    handle;                                  \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   146
	})
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
   147
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   148
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   149
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   150
 * 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
   151
 * 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
   152
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   153
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   154
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   155
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   156
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
   157
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
   158
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   159
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   161
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   162
48194c26a46c Initial revision
claus
parents:
diff changeset
   163
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   164
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   165
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   166
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   167
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   168
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   169
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   170
48194c26a46c Initial revision
claus
parents:
diff changeset
   171
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   172
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   173
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   174
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   175
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   176
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   177
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   178
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   179
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   180
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   181
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   182
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   183
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   184
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   185
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   186
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   187
/*
186
claus
parents: 180
diff changeset
   188
 * PEX extension - if available
claus
parents: 180
diff changeset
   189
 */
claus
parents: 180
diff changeset
   190
#ifdef PEX5
claus
parents: 180
diff changeset
   191
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   192
#endif
claus
parents: 180
diff changeset
   193
claus
parents: 180
diff changeset
   194
/*
claus
parents: 180
diff changeset
   195
 * XImage extension - if available
claus
parents: 180
diff changeset
   196
 */
claus
parents: 180
diff changeset
   197
#ifdef XIE
claus
parents: 180
diff changeset
   198
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   199
#endif
claus
parents: 180
diff changeset
   200
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   201
/*
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   202
 * multiscreen extension - if available
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   203
 */
5865
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   204
#ifdef XINERAMA
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   205
# include <X11/extensions/Xinerama.h>
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   206
#endif
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   207
186
claus
parents: 180
diff changeset
   208
/*
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   209
 * XCURSOR extension - if available
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   210
 */
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   211
#ifdef XCURSOR
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   212
# include <X11/Xcursor/Xcursor.h>
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   213
#endif
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   214
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   215
/*
6159
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   216
 * xft library (based on RENDER extension) - if available
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   217
 */
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   218
#ifdef XFT
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   219
# include <X11/Xft/Xft.h>
6231
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   220
# include <X11/extensions/Xrender.h>
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   221
# include <X11/extensions/render.h>
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   222
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   223
# define XFT_FONT(x)            __HANDLE_VAL(XftFont*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   224
# define XFT_FONT_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftFontHandle")
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   225
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   226
# define XFT_DRAW(x)            __HANDLE_VAL(XftDraw*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   227
# define XFT_DRAW_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftDrawHandle")
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   228
#endif // XFT
6159
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   229
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   230
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   231
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   232
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   233
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   234
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   235
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   236
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   237
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   238
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   239
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   240
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   241
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   242
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   243
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   244
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   245
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   246
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   247
 * if nformats cannot be found in the Display structure ...
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   248
 */
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   249
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   250
#endif
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   251
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   252
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   253
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   254
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   255
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   256
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   257
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   258
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   259
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   260
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   261
# define DISPLAY(x)    __HANDLE_VAL(Display*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   262
# define SCREEN(x)     ((int)(__intVal(x)))
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   263
# define DRAWABLE(x)   __HANDLE_VAL(Drawable, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   264
# define GC(x)         __HANDLE_VAL(GC, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   265
# define VISUAL(x)     __HANDLE_VAL(Visual*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   266
# define COLORMAP(x)   __HANDLE_VAL(Colormap, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   267
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   268
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   269
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   270
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   271
 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   272
#define __DisplayVal(o)      (Display *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   273
#define __DrawableVal(o)     (Drawable)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   274
#define __WindowVal(o)       (Window)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   275
#define __PixmapVal(o)       (Pixmap)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   276
#define __GCVal(o)           (GC)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   277
#define __CursorVal(o)       (Cursor)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   278
#define __FontVal(o)         (XFontStruct *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   279
#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
   280
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   281
#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
   282
#define __AtomVal(o)         __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   283
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   284
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   285
#define myDpy                __DisplayVal(__INST(displayId))
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   286
#define ISCONNECTED          ((__INST(displayId) != nil) && (__INST(hasConnectionBroken) != nil))
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   287
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   288
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   289
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   290
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   291
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   292
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   293
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   294
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   295
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   296
/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   297
 * these two macros should be placed around X-lib calls,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   298
 * which may block due to a broken connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   299
 * They setup/remove a VM-timeout which raises an exception
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   300
 * after xlibTimeout seconds.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   301
 * This exception will shutDown the connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   302
 * Q: is this a good idea for the local display ?
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   303
 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   304
#define __ENTER_XLIB(whichTimeout)   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   305
    { \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   306
	__blockingPrimitiveTimoutHandler__ = (voidFUNC)__XTimeoutErrorHandler; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   307
	__blockingPrimitiveTimeoutArg__ = self; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   308
	__blockingPrimitiveTimeout__ = whichTimeout; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   309
    } {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   310
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   311
#define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   312
    { \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   313
	__blockingPrimitiveTimoutHandler__ = (voidFUNC)0; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   314
	__blockingPrimitiveTimeoutArg__ = nil; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   315
	__blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   316
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   317
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   318
#define ENTER_XLIB()   __ENTER_XLIB(__intVal(__INST(xlibTimeout)) * 1000)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   319
#define ENTER_XLIB2()  __ENTER_XLIB(__intVal(__INST(xlibTimeoutForWindowCreation)) * 1000)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   320
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   321
#ifdef SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   322
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   323
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   324
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   325
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   326
# ifndef MWM_HINTS_FUNCTIONS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   327
#  define MWM_HINTS_FUNCTIONS       (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   328
#  define MWM_HINTS_DECORATIONS     (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   329
#  define MWM_HINTS_INPUT_MODE      (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   330
#  define MWM_HINTS_STATUS          (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   331
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   332
#  define MWM_FUNC_ALL              (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   333
#  define MWM_FUNC_RESIZE           (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   334
#  define MWM_FUNC_MOVE             (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   335
#  define MWM_FUNC_MINIMIZE         (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   336
#  define MWM_FUNC_MAXIMIZE         (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   337
#  define MWM_FUNC_CLOSE            (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   338
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   339
#  define MWM_INPUT_MODELESS                      0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   340
#  define MWM_INPUT_PRIMARY_APPLICATION_MODAL     1
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   341
#  define MWM_INPUT_SYSTEM_MODAL                  2
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   342
#  define MWM_INPUT_FULL_APPLICATION_MODAL        3
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   343
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   344
#  define MWM_DECOR_NONE            0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   345
#  define MWM_DECOR_ALL             (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   346
#  define MWM_DECOR_BORDER          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   347
#  define MWM_DECOR_RESIZEH         (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   348
#  define MWM_DECOR_TITLE           (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   349
#  define MWM_DECOR_MENU            (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   350
#  define MWM_DECOR_MINIMIZE        (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   351
#  define MWM_DECOR_MAXIMIZE        (1L << 6)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   352
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   353
#endif /* SUPPORT_MOTIF_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   354
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   355
/*
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   356
 * openlook hints are not supported yet
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   357
 * - noone needs them anymore ;-(
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   358
 */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   359
#ifdef SUPPORT_OPENLOOCK_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   360
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   361
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   362
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   363
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   364
# ifndef OL_DECOR_CLOSE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   365
#  define OL_DECOR_CLOSE            (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   366
#  define OL_DECOR_RESIZEH          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   367
#  define OL_DECOR_HEADER           (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   368
#  define OL_DECOR_ICON_NAME        (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   369
#  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
   370
#  define OL_ANY_HINTS              (1L << 7)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   371
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   372
#endif /* SUPPORT_OPENLOOCK_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   373
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
   374
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   375
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   376
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   377
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   378
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   379
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   380
/*
146
claus
parents: 145
diff changeset
   381
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   382
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   383
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   384
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   385
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   386
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   387
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   388
static int __debug__ = 0;
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   389
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   390
#define DPRINTF(x)      if (__debug__) { console_printf x; }
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   391
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   392
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   393
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   394
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   395
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   396
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   397
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   398
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   399
 * 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
   400
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   401
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   402
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   403
# ifdef __GNUC__
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   404
VOLATILE
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   405
# endif
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
   406
static void
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   407
dummyToForceLoading() {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   408
	XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   409
	XCloseDisplay(0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   410
	XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   411
	XSetWindowColormap(0, 0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   412
	XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   413
# ifdef SHM
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   414
	XShmAttach(0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   415
	XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   416
	XShmDetach(0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   417
	XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   418
	shmctl(0,0,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   419
	fgetc(0);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   420
# endif  // SHM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   421
}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   422
#endif // !ELF
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   423
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   424
static char* requestNames[] = {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   425
    "X_CreateWindow",               // 0
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   426
    "X_ChangeWindowAttributes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   427
    "X_GetWindowAttributes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   428
    "X_DestroyWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   429
    "X_DestroySubwindows",          // 4
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   430
    "X_ChangeSaveSet",              // 5
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   431
    "X_ReparentWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   432
    "X_MapWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   433
    "X_MapSubwindows",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   434
    "X_UnmapWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   435
    "X_UnmapSubwindows",            // 10
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   436
    "X_ConfigureWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   437
    "X_CirculateWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   438
    "X_GetGeometry",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   439
    "X_QueryTree",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   440
    "X_InternAtom",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   441
    "X_GetAtomName",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   442
    "X_ChangeProperty",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   443
    "X_DeleteProperty",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   444
    "X_GetProperty",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   445
    "X_ListProperties",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   446
    "X_SetSelectionOwner",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   447
    "X_GetSelectionOwner",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   448
    "X_ConvertSelection",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   449
    "X_SendEvent",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   450
    "X_GrabPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   451
    "X_UngrabPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   452
    "X_GrabButton",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   453
    "X_UngrabButton",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   454
    "X_ChangeActivePointerGrab",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   455
    "X_GrabKeyboard",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   456
    "X_UngrabKeyboard",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   457
    "X_GrabKey",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   458
    "X_UngrabKey",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   459
    "X_AllowEvents",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   460
    "X_GrabServer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   461
    "X_UngrabServer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   462
    "X_QueryPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   463
    "X_GetMotionEvents",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   464
    "X_TranslateCoords",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   465
    "X_WarpPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   466
    "X_SetInputFocus",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   467
    "X_GetInputFocus",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   468
    "X_QueryKeymap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   469
    "X_OpenFont",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   470
    "X_CloseFont",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   471
    "X_QueryFont",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   472
    "X_QueryTextExtents",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   473
    "X_ListFonts",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   474
    "X_ListFontsWithInfo",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   475
    "X_SetFontPath",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   476
    "X_GetFontPath",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   477
    "X_CreatePixma",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   478
    "X_FreePixmap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   479
    "X_CreateGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   480
    "X_ChangeGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   481
    "X_CopyGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   482
    "X_SetDashes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   483
    "X_SetClipRectangles",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   484
    "X_FreeGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   485
    "X_ClearArea",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   486
    "X_CopyArea",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   487
    "X_CopyPlane",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   488
    "X_PolyPoint",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   489
    "X_PolyLine",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   490
    "X_PolySegment",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   491
    "X_PolyRectangle",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   492
    "X_PolyArc",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   493
    "X_FillPoly",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   494
    "X_PolyFillRectangle",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   495
    "X_PolyFillArc",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   496
    "X_PutImage",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   497
    "X_GetImage",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   498
    "X_PolyText8",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   499
    "X_PolyText16",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   500
    "X_ImageText8",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   501
    "X_ImageText16",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   502
    "X_CreateColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   503
    "X_FreeColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   504
    "X_CopyColormapAndFree",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   505
    "X_InstallColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   506
    "X_UninstallColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   507
    "X_ListInstalledColormaps",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   508
    "X_AllocColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   509
    "X_AllocNamedColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   510
    "X_AllocColorCells",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   511
    "X_AllocColorPlanes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   512
    "X_FreeColors",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   513
    "X_StoreColors",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   514
    "X_StoreNamedColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   515
    "X_QueryColors",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   516
    "X_LookupColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   517
    "X_CreateCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   518
    "X_CreateGlyphCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   519
    "X_FreeCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   520
    "X_RecolorCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   521
    "X_QueryBestSize",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   522
    "X_QueryExtension",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   523
    "X_ListExtensions",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   524
    "X_ChangeKeyboardMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   525
    "X_GetKeyboardMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   526
    "X_ChangeKeyboardControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   527
    "X_GetKeyboardControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   528
    "X_Bell",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   529
    "X_ChangePointerControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   530
    "X_GetPointerControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   531
    "X_SetScreenSaver",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   532
    "X_GetScreenSaver",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   533
    "X_ChangeHosts",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   534
    "X_ListHosts",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   535
    "X_SetAccessControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   536
    "X_SetCloseDownMode",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   537
    "X_KillClient",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   538
    "X_RotateProperties",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   539
    "X_ForceScreenSaver",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   540
    "X_SetPointerMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   541
    "X_GetPointerMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   542
    "X_SetModifierMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   543
    "X_GetModifierMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   544
};
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   545
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   546
#if !defined(__INCREMENTAL_COMPILE__)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   547
// __myInstPtr has been redefined/overwritten by private classes - restore
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   548
#undef __myInstPtr
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   549
#define __myInstPtr(obj) ((struct __XWorkstation_struct *)(obj))
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   550
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   551
/*
144
claus
parents: 143
diff changeset
   552
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   553
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   554
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   555
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   556
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   557
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   558
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   559
int
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   560
__XErrorHandler__(Display *dpy, XErrorEvent *event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   561
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   562
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   563
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   564
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   565
    if (lastErrorMsg[0] == '\0') {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   566
	sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   567
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   568
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   569
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   570
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   571
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   572
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   573
	 * this is a BadWindow error for X_DestroyWindow.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   574
	 * ignore it here, since it results from the GC freeing windows
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   575
	 * in non bottom-up window order.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   576
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   577
	return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   578
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   579
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   580
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   581
	char *requestName = "?";
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   582
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   583
	if (event->request_code < (sizeof(requestNames)/sizeof(char *))) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   584
	    requestName = requestNames[event->request_code];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   585
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   586
	console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) \"%s\", min=%d (0x%x), resource=%"_lx_"\n",
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   587
			event->request_code, event->request_code, requestName,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   588
			event->minor_code, event->minor_code, (INT)(event->resourceid));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   589
	console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   590
			event->error_code, lastErrorMsg);
6231
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   591
    }
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
   592
#if 0
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
   593
    // cg: should no longer be needed - librun no longer sends an errorInterrupt while running on C-stack
6231
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   594
#ifdef XFT
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   595
    if ((strncmp(lastErrorMsg, "RenderBadPicture", 16) == 0)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   596
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   597
	 * this is a RenderBadPicture error from XFT drawing.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   598
	 * ignore it for now, as this is due to an incomplete implementation
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   599
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   600
	console_fprintf(stderr, "XWorkstation [info]: x-error ignored\n");
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   601
	return 0;
6231
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   602
    }
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   603
#endif
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
   604
#endif
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   605
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   606
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   607
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   608
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   609
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   610
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   611
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   612
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   613
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   614
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   615
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   616
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   617
int
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   618
__XIOErrorHandler__(Display *dpy)
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   619
{
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   620
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   621
	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
   622
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   623
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   624
						  __MKEXTERNALADDRESS(dpy));
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   625
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   626
#if 0
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   627
    /*
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   628
     * don't do this.
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   629
     * 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
   630
     */
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   631
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   632
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   633
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   634
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   635
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   636
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   637
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   638
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   639
    /* never reached */
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   640
#endif
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   641
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   642
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   643
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   644
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   645
/*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   646
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   647
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   648
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   649
 * timeoutHandler has been set.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   650
 */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   651
void
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   652
__XTimeoutErrorHandler(OBJ displayDeviceInst)
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   653
{
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   654
    if ((displayDeviceInst == @global(MainDisplay))
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   655
	|| (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   656
	console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   657
	return;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   658
    }
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   659
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   660
	console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst);
4636
6c715971d212 Fix display timeout error handling
Stefan Vogel <sv@exept.de>
parents: 4635
diff changeset
   661
    }
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   662
    __OINST(displayDeviceInst, hasConnectionBroken) = true;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   663
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   664
    __PROTECT__(displayDeviceInst);
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   665
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   666
    __UNPROTECT__(displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   667
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   668
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   669
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   670
     */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   671
    if (__OINST(displayDeviceInst, displayId) != nil) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   672
	__internalError("unhandled X11 display timeout error");
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   673
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   674
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   675
	 * the current process failed to do an X11 request.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   676
	 * Terminate it!
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   677
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   678
	__terminateProcess(0);      /* soft terminate */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   679
	__terminateProcess(1);      /* hard terminate */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   680
    }
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   681
}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   682
#endif // __INCREMENTAL_COMPILE__
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   683
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   684
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   685
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   686
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   687
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   688
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   689
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   690
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   691
COPYRIGHT (c) 1989 by Claus Gittinger
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   692
	      All Rights Reserved
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   693
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   694
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   695
 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
   696
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   697
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   698
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   699
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   700
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   701
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   702
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   703
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   704
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   705
    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
   706
    from DeviceWorkstation.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   707
    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
   708
    in theory (and in our practice), you can create Views on many displays
7507
cb7c25da60d0 #OTHER by mawalch
mawalch
parents: 7506
diff changeset
   709
    simultaneously. However, the default setup is for one display only.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   710
    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
   711
    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
   712
    different protocol (ApplicationModel openOnDevice:) or by temporarily answering
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   713
    the other device to the currentScreen query.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   714
    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
   715
    query is answered by the launcher when opening its applications.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   716
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   717
    Timeouts:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   718
	sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   719
	default, this would lead to a locked ST/X system.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   720
	Therefore, this class defines a timeOut, whenever doing an Xlib call.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   721
	The default for this timeout is 30seconds.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   722
	This may be a problem with windowmanagers which show a rubber-band rectangle
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   723
	when creating windows.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   724
	If the user does not specify the rectangle within 30 seconds, the device assumes
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   725
	a timeout and closes the connection.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   726
	As a (kludgy) workaround, a second timeout value is used for window-creation.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   727
	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
   728
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   729
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   730
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   731
    [author:]
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   732
	Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   733
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   734
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   735
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   736
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   737
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   738
initialize
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
   739
    "/ ConservativeSync is required for some Xlib implementation,
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
   740
    "/ where eventPending returns wrong if we do not flush the buffer.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
   741
    "/ (especially Win32 & Xlib)
6363
1695f666d823 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6350
diff changeset
   742
    ConservativeSync := OperatingSystem isMSWINDOWSlike.
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   743
3267
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   744
    "/ some XServers crash, when given too long strings in XDrawString/XDrawInageString.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   745
    "/ the following is an adjustable soft-limit.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   746
    MaxStringLength := 4096.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   747
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   748
    "/ 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
   749
    DefaultXLibTimeout := 30.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   750
    DefaultXLibTimeoutForWindowCreation := 5*60.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   751
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   752
    RawKeySymTranslation isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   753
	"/ the following table maps X-keyevents to ST/X
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   754
	"/ device independend events.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   755
	"/ It is NOT meant as a keyboardMap replacement.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   756
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   757
	RawKeySymTranslation := Dictionary new:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   758
	RawKeySymTranslation
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   759
	    at:#'Delete_line' put:#DeleteLine;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   760
	    at:#'Delete_word' put:#DeleteWord;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   761
	    at:#Down put:#CursorDown;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   762
	    at:#Up put:#CursorUp;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   763
	    at:#Left put:#CursorLeft;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   764
	    at:#Right put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   765
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   766
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   767
    "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
   768
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   769
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   770
!XWorkstation class methodsFor:'accessing-display capabilities'!
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   771
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   772
hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   773
%{
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   774
#ifdef XCURSOR
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   775
    RETURN(true);
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   776
#else
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   777
    RETURN(false);
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   778
#endif
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   779
%}
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   780
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   781
     Display hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   782
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   783
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   784
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   785
hasXftLibrary
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   786
%{
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   787
#ifdef XFT
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   788
    RETURN(true);
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   789
#else
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   790
    RETURN(false);
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   791
#endif
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   792
%}
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   793
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   794
     Display hasXftLibrary
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   795
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   796
! !
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   797
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   798
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   799
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   800
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   801
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   802
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   803
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   804
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   805
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   806
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   807
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   808
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   809
#ifdef COUNT_RESOURCES
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   810
    console_fprintf(stderr, "colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n",
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   811
	    __cnt_color, __cnt_bitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   812
	    __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
   813
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   814
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   815
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   816
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   817
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   818
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   819
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   820
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   821
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   822
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   823
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   824
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   825
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   826
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   827
getConnectionTimeOut
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   828
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   829
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   830
    ^ DefaultXLibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   831
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   832
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   833
getConnectionTimeOutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   834
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   835
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   836
    ^ DefaultXLibTimeoutForWindowCreation
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   837
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   838
135
claus
parents: 133
diff changeset
   839
lastErrorString
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   840
    "return the last X-error string -
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   841
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   842
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   843
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   844
    |string s match line requestCode|
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   845
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   846
    string := self errorStringOfLastError.
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   847
    requestCode := self requestCodeOfLastError.
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   848
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   849
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   850
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   851
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   852
    "
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   853
    match := 'XRequest.' , requestCode printString.
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   854
    ErrorDBCache isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   855
	ErrorDBCache := IdentityDictionary new.
6231
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   856
    ].
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   857
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   858
    "if there is no XErrorDB or no entry, the line for the requestCode is cached as nil"
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   859
    line := ErrorDBCache at:requestCode ifAbsentPut:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   860
	    |errorLine|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   861
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   862
	    s := '/usr/share/X11/XErrorDB' asFilename readStreamOrNil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   863
	    s notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   864
		errorLine := s peekForLineStartingWith:match.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   865
		errorLine notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   866
		    errorLine := errorLine copyFrom:(errorLine indexOf:$:)+1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   867
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   868
		s close.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   869
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   870
	    errorLine
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   871
	].
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   872
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   873
    line isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   874
	line := match
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   875
    ].
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   876
    ^ string , ' in ' , line.
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   877
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   878
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   879
	Screen lastErrorString
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   880
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   881
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   882
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   883
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   884
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   885
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   886
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   887
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   888
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   889
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   890
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   891
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   892
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   893
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   894
%}
135
claus
parents: 133
diff changeset
   895
!
claus
parents: 133
diff changeset
   896
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   897
resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   898
%{  /* NOCONTEXT */
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   899
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   900
      if (lastResource != 0) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   901
	 RETURN ( __MKEXTERNALADDRESS(lastResource) );
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   902
      }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   903
%}.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   904
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   905
     ^ nil
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   906
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   907
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   908
     "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   909
	 Screen resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   910
     "
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   911
!
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   912
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   913
setConnectionTimeOut:seconds
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   914
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   915
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   916
    DefaultXLibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   917
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   918
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   919
setConnectionTimeOutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   920
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   921
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   922
    DefaultXLibTimeoutForWindowCreation := seconds
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   923
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   924
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   925
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   926
7086
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   927
isX11Platform
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   928
    ^ true
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   929
!
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   930
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   931
platformName
133
claus
parents: 132
diff changeset
   932
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   933
     Return a string describing the display systems platform.
5036
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   934
     XWorkstation always returns #X11."
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   935
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   936
    ^ #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
   937
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   938
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   939
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   940
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   941
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   942
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   943
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   944
    "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
   945
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   946
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   947
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   948
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   949
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   950
!XWorkstation methodsFor:'accessing'!
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   951
6177
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   952
displayId
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   953
    ^ displayId
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   954
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   955
    "Created: / 20-12-2013 / 11:02:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   956
!
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   957
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   958
displayIdOrErrorIfBroken
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   959
    (hasConnectionBroken or:[displayId isNil]) ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
   960
	self primitiveFailedOrClosedConnection.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
   961
	^ nil.
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   962
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   963
    ^ displayId
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   964
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   965
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   966
displayIdOrNilIfBroken
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   967
    hasConnectionBroken ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
   968
	^ nil.
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   969
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   970
    ^ displayId
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   971
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   972
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   973
maxOperationsUntilFlush
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   974
    ^ maxOperationsUntilFlush
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   975
!
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   976
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   977
maxOperationsUntilFlush:anIntegerOrNil
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   978
    "if not nil, after anInteger number of draw operations
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   979
     a flush is performed.
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   980
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   981
     This is to work around a drawing problem which occurs on
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   982
     Ubuntu 12.04 64bit running on a VMware player (2013-11)."
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   983
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   984
    maxOperationsUntilFlush := anIntegerOrNil.
6177
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   985
!
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   986
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   987
screen
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   988
    ^ screen
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   989
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   990
    "Created: / 20-12-2013 / 11:02:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   991
! !
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   992
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   993
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   994
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   995
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   996
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   997
     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
   998
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   999
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1000
     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
  1001
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1002
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1003
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1004
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1005
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1006
    prev := activateOnClick ? false.
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1007
    aBoolean notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1008
	activateOnClick := aBoolean.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1009
    ].
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1010
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1011
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1012
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1013
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1014
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1015
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1016
!
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1017
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1018
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1019
    "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
  1020
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1021
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1022
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1023
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1024
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1025
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1026
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1027
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1028
asPseudoDeviceWithoutXFTSupport
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1029
    "return a pseudo device to be used when drawing into pixmaps
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1030
     on a device where xft-drawing into pixmaps is broken.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1031
     This is a temporary hack, to be removed when that problem is fixed in xft;
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1032
     then, we should return self here."
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  1033
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1034
    ^ PseudoDeviceWithoutXFTSupport basicNew realDevice:self
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1035
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1036
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1037
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1038
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1039
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1040
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1041
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1042
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1043
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1044
    "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
  1045
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1046
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1047
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1048
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1049
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1050
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1051
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1052
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1053
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1054
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1055
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1056
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1057
    "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
  1058
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1059
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1060
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1061
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1062
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1063
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1064
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1065
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1066
    "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
  1067
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1068
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1069
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1070
    RETURN (__MKSMALLINT(Button3MotionMask));
295
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
!
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
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1075
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1076
     This is the devices mask."
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
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1079
    if (aButton == __MKSMALLINT(1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1080
	RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1081
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1082
    if (aButton == __MKSMALLINT(2)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1083
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1084
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1085
    if (aButton == __MKSMALLINT(3)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1086
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1087
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1088
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1089
    ^ nil
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
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1092
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1093
    "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
  1094
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1095
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1096
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1097
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1098
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1099
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1100
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1101
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
  1102
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1103
48194c26a46c Initial revision
claus
parents:
diff changeset
  1104
%{  /* NOCONTEXT */
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1105
#ifndef __win32__
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1106
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1107
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1108
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1109
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1110
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1111
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1112
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1113
133
claus
parents: 132
diff changeset
  1114
displayName
claus
parents: 132
diff changeset
  1115
    "return the X-connections display name.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1116
     This is (currently) nil for the default display,
133
claus
parents: 132
diff changeset
  1117
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
  1118
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
  1119
claus
parents: 132
diff changeset
  1120
    ^ displayName
claus
parents: 132
diff changeset
  1121
!
claus
parents: 132
diff changeset
  1122
4153
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1123
displayName: something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1124
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1125
    displayName := something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1126
!
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1127
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1128
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1129
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1130
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1131
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1132
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1133
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1134
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1135
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1136
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1137
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1138
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1139
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1140
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1141
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1142
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1143
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1144
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1145
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1146
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1147
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1148
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1149
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1150
	RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1151
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1152
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1153
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1154
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1155
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1156
     Display serverVendor
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1157
     Display platformName
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1158
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1159
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1160
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1161
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1162
    "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
  1163
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1164
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1165
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1166
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1167
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1168
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1169
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1170
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1171
     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
  1172
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1173
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1174
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1175
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1176
    |x1 y1 x2 y2 rootWindowId|
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1177
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1178
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1179
    y1 := y2 := aPoint y truncated.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1180
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1181
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1182
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1183
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1184
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1185
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1186
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1187
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1188
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1189
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1190
     && __bothSmallInteger(x1, y1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1191
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1192
	Window rootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1193
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1194
	w1 = __WindowVal(windowId1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1195
	w2 = __WindowVal(windowId2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1196
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1197
	rootWin = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1198
	if (w1 == rootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1199
	    w1 = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1200
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1201
	if (w2 == rootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1202
	    w2 = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1203
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1204
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1205
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1206
	XTranslateCoordinates(dpy, w1, w2,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1207
			      __intVal(x1), __intVal(y1),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1208
			      &xpos, &ypos, &child_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1209
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1210
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1211
	x2 = __MKSMALLINT(xpos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1212
	y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1213
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1214
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1215
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1216
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1217
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1218
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1219
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1220
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1221
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1222
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1223
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1224
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1225
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1226
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1227
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1228
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1229
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1230
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1231
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1232
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1233
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1234
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1235
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1236
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1237
    "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
  1238
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1239
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1240
     - 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
  1241
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1242
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1243
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1244
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1245
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1246
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1247
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1248
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1249
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1250
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1251
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1252
     && __isPoint(aPoint)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1253
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1254
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1255
	xp = _point_X(aPoint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1256
	yp = _point_Y(aPoint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1257
	if (__bothSmallInteger(xp, yp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1258
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1259
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1260
	    XTranslateCoordinates(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1261
				  RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1262
				  __WindowVal(windowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1263
				  __intVal(xp), __intVal(yp),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1264
				  &xpos, &ypos, &child_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1265
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1266
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1267
	    if (child_ret) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1268
		RETURN ( __MKEXTERNALADDRESS(child_ret) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1269
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1270
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1271
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1272
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1273
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1274
    windowId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1275
	aPoint isPoint ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1276
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1277
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1278
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1279
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1280
    ^ nil
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1281
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1282
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1283
      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
  1284
    "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1285
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1286
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1287
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1288
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1289
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1290
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1291
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1292
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1293
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1294
    if (ISCONNECTED
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1295
     && (__INST(rootId) != __INST(virtualRootId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1296
     && __isExternalAddress(__INST(virtualRootId))) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1297
	Window vRootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1298
	Window root;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1299
	int x, y;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1300
	unsigned int width, height;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1301
	unsigned int dummy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1302
	int ret;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1303
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1304
	vRootWin = __WindowVal(__INST(virtualRootId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1305
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1306
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1307
					  &dummy, &dummy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1308
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1309
	if (ret) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1310
	    RETURN ( __MKPOINT_INT(width, height) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1311
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1312
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1313
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1314
    ^ width @ height
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1315
   "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1316
     Display virtualExtent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1317
     Display extent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1318
   "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1319
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1320
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1321
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1322
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1323
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1324
    ^ whitepixel
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1325
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1326
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1327
xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1328
    ^ xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1329
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1330
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1331
xlibTimeout:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1332
    xlibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1333
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1334
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1335
xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1336
    ^ xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1337
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1338
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1339
xlibTimeoutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1340
    xlibTimeoutForWindowCreation := seconds
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1341
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1342
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
  1343
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1344
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1345
extentOfResizeHandle
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1346
    "if the window system needs any area for a window resize handle (such as on MACOS-X),
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  1347
     this area's extent is returned here. It is assumed, that this handle is located at the lower-right
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1348
     of the window.
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1349
     0@0 is returned for systems which locate the resize handles outside the client area.
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1350
     This may be used by the UI painter or programmatically to reserve some client area.
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1351
     This method must be redefined for displays which need it (i.e. X11 on osx)"
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1352
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1353
    OperatingSystem getOSType == #osx ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1354
	"/ should check for local display here - sigh, osx's Xserver does not give
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1355
	"/ us a hint through the server vendor...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1356
	^ 16@16
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1357
    ].
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1358
    ^ 0@0
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1359
!
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1360
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1361
hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1362
    "return true, if this workstation supports the X cursor extension.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1363
     This extension allows for deep cursors (depth > 1)"
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1364
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1365
    ^ self hasExtension:'CURSOR'
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1366
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1367
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1368
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1369
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1370
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1371
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1372
hasDPS
186
claus
parents: 180
diff changeset
  1373
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
  1374
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
  1375
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1376
48194c26a46c Initial revision
claus
parents:
diff changeset
  1377
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
  1378
claus
parents: 180
diff changeset
  1379
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1380
     Display hasDPS
186
claus
parents: 180
diff changeset
  1381
    "
claus
parents: 180
diff changeset
  1382
!
claus
parents: 180
diff changeset
  1383
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1384
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1385
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1386
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
  1387
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
  1388
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1389
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1390
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1391
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1392
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1393
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1394
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1395
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1396
     && __isStringLike(extensionString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1397
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1398
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1399
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1400
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1401
	LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1402
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1403
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1404
%}
186
claus
parents: 180
diff changeset
  1405
claus
parents: 180
diff changeset
  1406
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1407
     Display hasExtension:'XVideo'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1408
     Display hasExtension:'Input'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1409
     Display hasExtension:'GLX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1410
     Display hasExtension:'X3D-PEX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1411
     Display hasExtension:'XInputExtension'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1412
     Display hasExtension:'SHAPE'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1413
     Display hasExtension:'MIT-SHM'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1414
     Display hasExtension:'SGIFullScreenStereo'
186
claus
parents: 180
diff changeset
  1415
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1416
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1417
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1418
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1419
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1420
     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
  1421
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1422
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1423
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1424
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1425
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1426
     Display hasImageExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1427
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1428
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1429
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1430
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1431
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1432
     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
  1433
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1434
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1435
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1436
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1437
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1438
     Display hasInputExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1439
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1440
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1441
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1442
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1443
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1444
     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
  1445
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1446
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1447
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1448
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1449
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1450
     Display hasMultibuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1451
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1452
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1453
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1454
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1455
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1456
     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
  1457
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1458
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1459
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1460
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1461
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1462
     Display hasPEX
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1463
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1464
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1465
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1466
hasRenderExtension
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1467
    "return true, if this workstation supports the X render extension."
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1468
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1469
    ^ self hasExtension:'RENDER'
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1470
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1471
    "
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1472
     Display hasRenderExtension
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1473
    "
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1474
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1475
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1476
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1477
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1478
     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
  1479
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1480
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1481
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1482
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1483
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1484
     Display hasShm
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1485
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1486
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1487
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1488
hasXVideo
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1489
    "return true, if this workstation supports the XVideo extension.
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1490
     Both the server must support it, and the feature must have been
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1491
     enabled in the smalltalk system, for true to be returned."
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1492
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1493
    ^ hasXVideoExtension
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1494
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1495
    "
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1496
     Display hasXVideo
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1497
    "
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1498
!
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1499
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1500
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1501
    "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
  1502
     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
  1503
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1504
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1505
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1506
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1507
7141
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1508
    count := 0.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1509
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1510
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1511
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1512
    int cnt;
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
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1515
	Display *dpy = myDpy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1516
	int status;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1517
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1518
	ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1519
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1520
	LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1521
	if (status > 0) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1522
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1523
	   count = __MKSMALLINT(cnt);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1524
	}
7141
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1525
    }
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1526
%}.
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1527
    count == 0 ifTrue:[^ nil].
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1528
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1529
    ret := Array new:count.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1530
    1 to:count do:[ :i |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1531
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1532
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1533
%{
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1534
	XIconSize *slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1535
	minWidth = __MKSMALLINT(slp->min_width);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1536
	minHeight = __MKSMALLINT(slp->min_height);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1537
	maxWidth = __MKSMALLINT(slp->max_width);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1538
	maxHeight = __MKSMALLINT(slp->max_height);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1539
	widthStep = __MKSMALLINT(slp->width_inc);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1540
	heightStep = __MKSMALLINT(slp->height_inc);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1541
%}.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1542
	d := IdentityDictionary new:6.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1543
	d at:#minWidth put:minWidth.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1544
	d at:#maxWidth put:maxWidth.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1545
	d at:#widthStep put:widthStep.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1546
	d at:#minHeight put:minHeight.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1547
	d at:#maxHeight put:maxHeight.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1548
	d at:#heightStep put:heightStep.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1549
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1550
	ret at:i put:d.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1551
    ].
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
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1554
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1555
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1556
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1557
     Display iconSizes
295
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
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1561
ignoreBackingStore:aBoolean
7696
2e656340ab84 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7662
diff changeset
  1562
    "if the argument is true, the view's backingStore setting will be ignored, and
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1563
     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
  1564
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1565
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1566
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1567
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1568
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1569
monitorBounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1570
    "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
  1571
     The first monitor returned is the primary monitor"
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1572
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1573
    |numberOfMonitors resultArray bounds|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1574
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1575
%{
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1576
#ifdef XINERAMA
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1577
    if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1578
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1579
	XineramaScreenInfo *screenInfo;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1580
	int numDisplays;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1581
	OBJ *cResultArray;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1582
	int i, ci;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1583
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1584
	screenInfo = XineramaQueryScreens (dpy, &numDisplays);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1585
	if (screenInfo == 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1586
	    goto out;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1587
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1588
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1589
	numberOfMonitors = __mkSmallInteger(numDisplays);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1590
	resultArray = __ARRAY_NEW_INT(numDisplays * 5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1591
	cResultArray = __ArrayInstPtr(resultArray)->a_element;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1592
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1593
	for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1594
	    cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1595
	    cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1596
	    cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1597
	    cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1598
	    cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1599
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1600
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1601
	XFree(screenInfo);
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1602
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1603
#endif
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1604
out:;
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1605
%}.
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1606
    numberOfMonitors isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1607
	"no xinerama - the display is the only monitor"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1608
	^ Array with:self bounds.
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1609
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1610
    rawMonitorBounds = resultArray ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1611
	^ monitorBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1612
    ].
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1613
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1614
    bounds := Array new:numberOfMonitors.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1615
    1 to:numberOfMonitors do:[:idx|
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1616
	|rect baseIdx|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1617
	baseIdx := (idx-1) * 5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1618
	rect := Rectangle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1619
		    left:(resultArray at:baseIdx+2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1620
		    top:(resultArray at:baseIdx+3)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1621
		    width:(resultArray at:baseIdx+4)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1622
		    height:(resultArray at:baseIdx+5).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1623
	bounds at:idx put:rect.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1624
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1625
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1626
    rawMonitorBounds := resultArray.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1627
    monitorBounds := bounds.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1628
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1629
    "since the monitor configuration changed,
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1630
     we have to update the monitor settings"
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1631
5892
491bf533899e added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5891
diff changeset
  1632
    self initializeScreenBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1633
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1634
    ^ bounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1635
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1636
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1637
     Display monitorBounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1638
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1639
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1640
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1641
monitorBoundsAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1642
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1643
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1644
    bounds := self monitorBounds.
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  1645
    ^ bounds
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1646
	detect:[:eachRectangle| eachRectangle containsPoint:aPoint]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1647
	ifNone:[super monitorBoundsAt:aPoint].
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1648
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1649
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1650
     Screen current monitorBoundsAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1651
     Screen current monitorBoundsAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1652
     Screen current monitorBoundsAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1653
     Screen current monitorBoundsAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1654
     Screen current monitorBoundsAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1655
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1656
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1657
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1658
numberOfMonitors
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1659
    ^ self monitorBounds size
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1660
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1661
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1662
	Display numberOfMonitors
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1663
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1664
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1665
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1666
pointIsVisible:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1667
    "is the point visible?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1668
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1669
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1670
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1671
    bounds := self monitorBounds.
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1672
    ^ bounds contains:[:eachRectangle| eachRectangle containsPoint:aPoint].
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1673
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1674
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1675
     Screen current pointIsVisible:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1676
     Screen current pointIsVisible:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1677
     Screen current pointIsVisible:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1678
     Screen current pointIsVisible:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1679
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1680
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1681
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1682
pointsAreOnSameMonitor:point1 and:point2
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1683
    "are the two points on the same (multi-screen) monitors?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1684
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1685
    ^ (self monitorBoundsAt:point1) = (self monitorBoundsAt:point2)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1686
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1687
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1688
preferredIconSize
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1689
    "return the display's preferred size for icons.
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1690
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1691
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1692
    self serverVendor = 'Silicon Graphics' ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  1693
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1694
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1695
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1696
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1697
    "Created: / 10-06-1996 / 21:06:48 / cg"
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1698
    "Modified (comment): / 01-09-2017 / 09:58:31 / cg"
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1699
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1700
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1701
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1702
    "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
  1703
     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
  1704
     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
  1705
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1706
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1707
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1708
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1709
smallestMonitorHeight
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1710
    "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
  1711
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1712
    |minH|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1713
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1714
    minH := self usableHeight.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1715
    self monitorBounds do:[:eachBounds |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1716
	minH := minH min: eachBounds height.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1717
    ].
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1718
    ^ minH
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1719
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1720
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1721
	Display smallestMonitorHeight
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1722
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1723
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1724
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1725
supportedClipboards
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1726
    "answer a collection of symbols with the supported clipboards.
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1727
     X11 additionaly supports a buffer containing the currently selected text
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1728
     (in xterm) - the PRIMARY selection"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1729
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1730
    ^ #(clipboard selection)
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1731
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1732
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1733
supportedImageFormats
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1734
    "return an array with supported image formats;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1735
     each array entry is an attribute dictionary, consisting of
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1736
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1737
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1738
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1739
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1740
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1741
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1742
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1743
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1744
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1745
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1746
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1747
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1748
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1749
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1750
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1751
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1752
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1753
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1754
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1755
    1 to:nFormats do:[:index |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1756
	|info bitsPerPixelInfo depthInfo paddingInfo i|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1757
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1758
	i := index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1759
%{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1760
	ScreenFormat *format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1761
	Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1762
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1763
#ifdef NO_PRIVATE_DISPLAY_ACCESS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1764
	depthInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1765
	bitsPerPixelInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1766
	paddingInfo = __MKSMALLINT(8);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1767
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1768
	format = DISPLAYACCESS(dpy)->pixmap_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1769
	format += (__intVal(i)-1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1770
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1771
	depthInfo = __MKSMALLINT(format->depth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1772
	paddingInfo = __MKSMALLINT(format->scanline_pad);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1773
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1774
%}.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1775
	info := IdentityDictionary new.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1776
	info at:#depth put:depthInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1777
	info at:#bitsPerPixel put:bitsPerPixelInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1778
	info at:#padding put:paddingInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1779
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1780
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1781
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1782
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1783
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1784
     Display supportedImageFormats
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1785
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1786
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1787
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1788
supportsAnyViewBackgroundPixmaps
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1789
    "return true, if the device allows pixmaps as viewBackground."
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1790
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1791
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1792
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1793
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1794
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1795
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1796
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1797
    "return true, if this workstation supports arbitrary shaped windows.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1798
     Both the server must support it (the shape-extension),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1799
     and the feature must have been enabled in the smalltalk system,
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1800
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1801
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1802
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1803
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1804
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1805
     Display supportsArbitraryShapedViews
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1806
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1807
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1808
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1809
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1810
    "return true, if this device supports views as icons.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1811
     These can be drawn into like any other regular view, and therefore be easily animated.
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1812
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1813
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1814
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1815
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1816
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1817
     Display supportsIconViews
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1818
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1819
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1820
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1821
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1822
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1823
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1824
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1825
    "return true, if the device allows the given form pixmap
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1826
     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
  1827
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1828
7021
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1829
    ^ true
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1830
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1831
    "Created: / 4.5.1999 / 12:16:43 / cg"
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1832
!
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1833
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1834
supportsMaskedDrawingWithOffset:aForm
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1835
    "return true, if the device allows the given form pixmap
7022
f4531f98fd46 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7021
diff changeset
  1836
     to be used as paint color with a mask offset.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1837
     True returned here - X has no trouble with any mask."
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1838
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1839
    "/ XQuartz seems to have a bug here...
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  1840
    ^ OperatingSystem isOSXlike not.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1841
    "/ ^ true.
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1842
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1843
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1844
supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1845
    "return true, if the device allows reading the screen pixels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1846
     True returned here - X can do it"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1847
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1848
    "XQuartz seems to have a bug here...
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1849
     ...but only on XQuartz servers.
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1850
     Blame: I cannot ask via server vendor, if it's a Quartz display, because
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1851
     it does not return a valid server vendor string"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1852
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1853
	^ false
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1854
    ].
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1855
    ^ true
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1856
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1857
    "
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1858
     Display serverVendor
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1859
     Display supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1860
    "
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1861
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1862
    "Modified (comment): / 13-02-2017 / 20:35:34 / cg"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1863
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1864
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1865
supportsUTF8WindowLabels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1866
    "answer true, if window labels are to be utf-8 encoded"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1867
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1868
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1869
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1870
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1871
supportsVariableHeightFonts
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1872
    "are fonts with variable height supported?"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1873
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1874
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1875
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1876
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1877
supportsViewBackgroundPixmap:aForm
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1878
    "return true, if the device allows the given pixmap as viewBackground.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1879
     True returned here - X supports any size.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1880
     Other device types (windows) may restrict this to certain sizes."
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1881
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1882
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1883
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1884
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1885
    "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
  1886
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1887
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1888
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1889
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1890
     We do not depend on it being implemented, but some resizing operations
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1891
     are faster, if they are."
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1892
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1893
    ^ true
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1894
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1895
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1896
supportsXCursor
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1897
    "return true, if the XCursor extension (deep cursors ) are supported
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1898
     on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1899
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1900
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1901
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1902
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1903
     ^ self class hasXCursorLibrary
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1904
	and:[self hasCursorExtension]
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1905
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1906
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1907
     Display supportsXCursor
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1908
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1909
     Display class hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1910
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1911
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1912
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1913
supportsXftFonts
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1914
    "return true, if XftFonts (nice looking truetype fonts)
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1915
     are supported on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1916
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1917
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1918
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1919
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  1920
     ^ XftFontDescription notNil and:[hasXftLibrary].
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1921
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1922
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1923
     Display supportsXftFonts
6975
da4fb0542fca #FEATURE
Claus Gittinger <cg@exept.de>
parents: 6958
diff changeset
  1924
     Display hasRenderExtension
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1925
     Display class hasXftLibrary
6538
04f9cecef7c3 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6522
diff changeset
  1926
    "
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1927
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1928
7699
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1929
supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1930
    "return true, if XftFonts (nice looking truetype fonts)
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1931
     are supported when drawing into bitmaps on this display.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1932
     Currently, this does not work, so xft drawing must be disabled when
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1933
     rendering into bitmaps"
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1934
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1935
     ^ false.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1936
     "/ ^ self supportsXftFonts
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1937
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1938
    "
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1939
     Display supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1940
     Display hasRenderExtension
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1941
     Display class hasXftLibrary
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1942
    "
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1943
!
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1944
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1945
suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1946
    "return true, if this device wants to suppress shadow views
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1947
     (i.e. shadows under popups and modalBoxes).
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1948
     Some (slow) devices may want to return true here.
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1949
     Also, with XQuartz, it does not work, because we cannot readout the screen..."
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1950
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1951
    OperatingSystem isOSXlike ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1952
	^ true
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1953
    ].
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1954
    ^ super suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1955
!
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1956
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1957
usableHeightAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1958
    "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
  1959
     Normally, the same as height, but may be smaller, in
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1960
     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
  1961
     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
  1962
     which display is at the given x-position"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1963
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1964
    |h|
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1965
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1966
    h := (self monitorBoundsAt:aPoint) height.
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1967
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1968
	"/ take away some space for the dock at the bottom.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1969
	^ h - 50
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1970
    ].
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1971
    ^ h
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1972
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1973
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1974
     Screen current usableHeightAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1975
     Screen current usableHeightAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1976
     Screen current usableHeightAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1977
     Screen current usableHeightAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1978
     Screen current usableHeightAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1979
    "
7965
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1980
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1981
    "Modified (format): / 05-03-2017 / 11:25:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1982
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1983
48194c26a46c Initial revision
claus
parents:
diff changeset
  1984
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1985
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1986
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1987
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1988
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1989
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1990
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1991
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1992
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1993
    bitmapId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1994
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1995
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1996
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1997
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1998
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1999
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2000
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2001
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2002
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2003
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2004
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2005
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2006
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2007
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2008
     && __isStringLike(aString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2009
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2010
	char *filename;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2011
	int status;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2012
	Pixmap newBitmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2013
	unsigned b_width, b_height;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2014
	int b_x_hot, b_y_hot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2015
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2016
	filename = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2017
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2018
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2019
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2020
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2021
				 filename, &b_width, &b_height, &newBitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2022
				 &b_x_hot, &b_y_hot);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2023
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2024
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2025
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2026
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2027
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2028
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2029
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2030
	    w = __MKSMALLINT(b_width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2031
	    h = __MKSMALLINT(b_height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2032
	    id = __MKEXTERNALADDRESS(newBitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2033
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2034
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2035
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2036
    id notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2037
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2038
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2039
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2040
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2041
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2042
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2043
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2044
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2045
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2046
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2047
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2048
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2049
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2050
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2051
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2052
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2053
	Display *dpy = myDpy;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2054
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2055
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2056
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2057
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2058
				       __intVal(w), __intVal(h), 1);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2059
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2060
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2061
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2062
	    __cnt_bitmap++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2063
#endif
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2064
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2065
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2066
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2067
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2068
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2069
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2070
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2071
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2072
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  2073
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  2074
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2075
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2076
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2077
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2078
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2079
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2080
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2081
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2082
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2083
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2084
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2085
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2086
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2087
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2088
				       __intVal(w), __intVal(h), __intVal(d));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2089
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2090
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2091
	if (newBitmap)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2092
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2093
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2094
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2095
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2096
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  2097
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2098
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2099
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2100
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2101
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  2102
createWindowFor:aView type:typeSymbol
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2103
		 origin:origin
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2104
		 extent:extent
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2105
		 minExtent:minExt
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2106
		 maxExtent:maxExt
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2107
		 borderWidth:bWidth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2108
		 subViewOf:wsuperView
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2109
		 style:wStyle
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2110
		 inputOnly:winputOnly
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2111
		 label:wlabel
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2112
		 owner:wowner
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2113
		 icon:wicon iconMask:wiconMask
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2114
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2115
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2116
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2117
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2118
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2119
     bColorId wsuperViewId windowId isTopWindow
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2120
     weventMask bitGravity viewGravity vBgColor
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  2121
     vBgForm deepForm preferredVisual preferredDepth
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2122
     wiconId wiconMaskId wiconViewId windowGroupWindowId|
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2123
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2124
    self isOpen ifFalse:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2125
	self primitiveFailedOrClosedConnection.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2126
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2127
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2128
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2129
    origin notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2130
	xpos := origin x.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2131
	ypos := origin y.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2132
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2133
    extent notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2134
	wwidth := extent x.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2135
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2136
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2137
    minExt notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2138
	minWidth := minExt x.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2139
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2140
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2141
    maxExt notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2142
	maxWidth := maxExt x.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2143
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2144
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2145
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2146
    wsuperView notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2147
	wsuperViewId := wsuperView id
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2148
    ] ifFalse:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2149
	isTopWindow := true.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2150
	aView class ~~ WindowGroupWindow ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2151
	    windowGroupWindow isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2152
		self getWindowGroupWindow.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2153
	    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2154
	    windowGroupWindowId := windowGroupWindow id.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2155
	].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2156
	wicon notNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2157
	    wiconId := wicon id.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2158
	    wiconMask notNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2159
		wiconMaskId := wiconMask id
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2160
	    ]
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2161
	].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2162
	wiconView notNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2163
	    wiconViewId := wiconView id
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2164
	].
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2165
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2166
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2167
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2168
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2169
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2170
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2171
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2172
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  2173
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2174
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2175
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2176
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2177
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2178
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2179
    XSizeHints sizehints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2180
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2181
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2182
    XFontStruct *f;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2183
    Pixmap backPixmap = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2184
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2185
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2186
    Atom WmQuitAppAtom, MotifWMHintsAtom;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  2187
    Atom STXDeviceAtom, UUIDAtom;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2188
    Atom atoms[3];
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2189
    int atomCount = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2190
48194c26a46c Initial revision
claus
parents:
diff changeset
  2191
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2192
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2193
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2194
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2195
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2196
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2197
    if (__bothSmallInteger(wwidth, wheight)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2198
	sizehints.flags |= PSize;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2199
	sizehints.width = __intVal(wwidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2200
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2201
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2202
    if (__bothSmallInteger(xpos, ypos)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2203
	sizehints.flags |= PPosition;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2204
	sizehints.x = __intVal(xpos);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2205
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2206
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2207
    if (__bothSmallInteger(minWidth, minHeight)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2208
	sizehints.flags |= PMinSize;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2209
	sizehints.min_width = __intVal(minWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2210
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2211
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2212
    if (__bothSmallInteger(maxWidth, maxHeight)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2213
	sizehints.flags |= PMaxSize;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2214
	sizehints.max_width = __intVal(maxWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2215
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2216
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2217
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  2218
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2219
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2220
    if (__isSmallInteger(bWidth)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2221
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2222
    } else {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2223
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2224
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2225
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2226
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2227
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2228
    if (__isExternalAddress(wsuperViewId)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2229
	parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2230
    } else {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2231
	parentWindow = RootWindow(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2232
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2233
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  2234
    if (wStyle == @symbol(popUp))
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2235
	xswa.override_redirect = 1;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2236
    else
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2237
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2238
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2239
    if (winputOnly == true)
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2240
	ioClass = InputOnly;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2241
    else
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2242
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2243
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2244
    if (__isSmallInteger(weventMask)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2245
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2246
    } else {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2247
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2248
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2249
48194c26a46c Initial revision
claus
parents:
diff changeset
  2250
    if (ioClass == InputOnly) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2251
	bw = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2252
	depth = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2253
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2254
    } else {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2255
	depth = DefaultDepth(dpy,screen);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2256
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2257
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2258
	if (backPixmap != (Pixmap)0) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2259
	    xswa.background_pixmap = backPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2260
	    flags |= CWBackPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2261
	} else {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2262
	    xswa.background_pixel = bg;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2263
	    flags |= CWBackPixel;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2264
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2265
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2266
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2267
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2268
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2269
    if (__isSmallInteger(preferredDepth)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2270
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2271
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2272
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2273
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2274
    if (preferredVisual != nil) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2275
	XVisualInfo vi;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2276
	int cls;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2277
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2278
	if (preferredVisual == @symbol(StaticGray))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2279
	    cls = StaticGray;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2280
	else if (preferredVisual == @symbol(GrayScale))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2281
	    cls = GrayScale;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2282
	else if (preferredVisual == @symbol(StaticColor))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2283
	    cls = StaticColor;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2284
	else if (preferredVisual == @symbol(PseudoColor))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2285
	    cls = PseudoColor;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2286
	else if (preferredVisual == @symbol(TrueColor))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2287
	    cls = TrueColor;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2288
	else if (preferredVisual == @symbol(DirectColor))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2289
	    cls = DirectColor;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2290
	else
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2291
	    cls = PseudoColor;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2292
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2293
	ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2294
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2295
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  2296
/*
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2297
	    console_fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  2298
*/
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2299
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2300
	LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2301
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2302
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2303
    ENTER_XLIB2();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2304
    newWindow = XCreateWindow(dpy, parentWindow,
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2305
			   sizehints.x, sizehints.y,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2306
			   sizehints.width, sizehints.height,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2307
			   bw, depth, ioClass, &visual,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2308
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2309
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2310
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2311
48194c26a46c Initial revision
claus
parents:
diff changeset
  2312
    if (! newWindow) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2313
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2314
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2315
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2316
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2317
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2318
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2319
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2320
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  2321
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  2322
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  2323
     */
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2324
    if (isTopWindow == true) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2325
	XWMHints wmhints;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2326
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2327
	wmhints.flags = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2328
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2329
	if (__isExternalAddress(wiconId)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2330
	    wmhints.icon_pixmap = __PixmapVal(wiconId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2331
	    wmhints.flags = IconPixmapHint;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2332
	    if (__isExternalAddress(wiconMaskId)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2333
		wmhints.icon_mask = __PixmapVal(wiconMaskId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2334
		wmhints.flags |= IconMaskHint;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2335
	    }
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2336
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2337
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2338
	if (__isExternalAddress(windowGroupWindowId)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2339
	    wmhints.window_group = __WindowVal(windowGroupWindowId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2340
	    wmhints.flags |= WindowGroupHint;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2341
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2342
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2343
	if (__isExternalAddress(wiconViewId)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2344
	    wmhints.flags |= IconWindowHint;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2345
	    wmhints.icon_window = __WindowVal(wiconViewId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2346
	};
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2347
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2348
/*
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2349
	wmhints.flags |= InputHint;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2350
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2351
*/
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2352
	ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2353
	XSetWMHints(dpy, newWindow, &wmhints);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2354
	XSetWMNormalHints(dpy, newWindow, &sizehints);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2355
	LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2356
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2357
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2358
	 * get atoms first (if not already known)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2359
	 */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2360
	if (__INST(protocolsAtom) == nil) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2361
	    ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2362
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2363
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2364
#ifdef USE_SAVEYOURSELF_ATOM
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2365
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2366
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2367
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2368
#ifdef USE_QUIT_APP_ATOM
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2369
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2370
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2371
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2372
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2373
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2374
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2375
	    UUIDAtom = XInternAtom(dpy, "UUID", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2376
	    __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2377
	    STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2378
	    __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2379
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2380
	    LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2381
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2382
#ifdef USE_QUIT_APP_ATOM
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2383
	    WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2384
#else
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2385
	    WmQuitAppAtom = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2386
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2387
	    WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2388
	    WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2389
#ifdef USE_SAVEYOURSELF_ATOM
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2390
	    WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2391
#else
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2392
	    WmSaveYourselfAtom = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2393
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2394
	    UUIDAtom = __AtomVal(__INST(uuidAtom));;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2395
	    STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2396
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2397
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2398
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2399
	 * tell window manager to not kill us but send an event instead
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2400
	 */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2401
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2402
#ifdef USE_SAVEYOURSELF_ATOM
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2403
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2404
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2405
#ifdef USE_QUIT_APP_ATOM
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2406
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2407
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2408
	ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2409
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2410
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2411
	LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2412
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2413
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2414
	 * an optional unique id (to mark stx-windows)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2415
	 */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2416
	if (__isBytes(__INST(uniqueDeviceID))) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2417
	    int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2418
	    unsigned char uuidBytes[32];
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2419
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2420
	    if (numUUIDBytes <= sizeof(uuidBytes)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2421
		Atom uuidAtom;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2422
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2423
		bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2424
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2425
		ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2426
		XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2427
				 uuidBytes, numUUIDBytes );
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2428
		LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2429
	    }
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2430
	}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2431
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2432
#ifdef SUPPORT_MOTIF_WM_HINTS
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2433
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2434
	 * less decoration
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2435
	 */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2436
	if ((wStyle == @symbol(undecorated))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2437
	 || (wStyle == @symbol(dialog2))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2438
	 || (wStyle == @symbol(notitle))
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2439
	) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2440
	    if (__INST(motifWMHintsAtom) == nil) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2441
		ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2442
		MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2443
		__INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2444
		LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2445
	    } else {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2446
		MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2447
	    }
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2448
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2449
	    {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2450
		struct hints {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2451
		    unsigned long flags;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2452
		    unsigned long functions;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2453
		    unsigned long decorations;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2454
		    long input_mode;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2455
		    unsigned long status;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2456
		} mvm_hints;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2457
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2458
		if (wStyle == @symbol(undecorated)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2459
		    mvm_hints.decorations = MWM_DECOR_NONE;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2460
		}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2461
		if (wStyle == @symbol(dialog2)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2462
		    mvm_hints.decorations = MWM_DECOR_BORDER
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2463
					    | MWM_DECOR_RESIZEH
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2464
					    | MWM_DECOR_TITLE
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2465
					    /* | MWM_DECOR_MENU */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2466
					    /* | MWM_DECOR_MINIMIZE */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2467
					    /* | MWM_DECOR_MAXIMIZE */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2468
					    ;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2469
		}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2470
		if (wStyle == @symbol(notitle)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2471
		    mvm_hints.decorations = MWM_DECOR_BORDER
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2472
					    /* | MWM_DECOR_RESIZEH  */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2473
					    /* | MWM_DECOR_TITLE    */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2474
					    /* | MWM_DECOR_MENU     */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2475
					    /* | MWM_DECOR_MINIMIZE */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2476
					    /* | MWM_DECOR_MAXIMIZE */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2477
					    ;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2478
		}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2479
		mvm_hints.flags =  MWM_HINTS_DECORATIONS;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2480
		ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2481
		XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2482
				     MotifWMHintsAtom, 32, PropModeReplace,
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2483
				     (unsigned char*)&mvm_hints, 5 );
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2484
		LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2485
	    }
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2486
	}
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  2487
#endif /* SUPPORT_MOTIF_WM_HINTS */
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2488
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2489
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2490
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2491
%}.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2492
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2493
"/    (wStyle ~= nil and:[wStyle ~= #normal]) ifTrue:[
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2494
"/        self setWindowType:wStyle in:windowId.
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2495
"/    ].
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2496
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2497
    (wsuperView isNil "this is a topwindow"
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2498
     and:[wlabel notEmptyOrNil]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2499
	self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2500
	    setIconName:wlabel in:windowId;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2501
	    setWindowName:wlabel in:windowId.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2502
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2503
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
  2504
    self addKnownView:aView withId:windowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2505
    ^ windowId
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2506
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2507
    "Modified: / 09-01-2013 / 10:43:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2508
    "Modified: / 18-03-2017 / 00:00:44 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2509
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2510
48194c26a46c Initial revision
claus
parents:
diff changeset
  2511
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2512
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2513
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2514
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2515
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2516
     * 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
  2517
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2518
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2519
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2520
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2521
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2522
    if (__isExternalAddress(aGCId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2523
	GC gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2524
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2525
	if (gc) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2526
	    __ExternalAddressInstPtr(aGCId)->e_address = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2527
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2528
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2529
	    XFreeGC(myDpy, gc);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
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
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2532
	    __cnt_gc--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2533
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2534
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2535
	    console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2536
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2537
	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
  2538
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2539
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2540
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2541
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2542
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2543
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2544
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2545
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2546
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2547
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2548
     * 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
  2549
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2550
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2551
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2552
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2553
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2554
    if (__isExternalAddress(aDrawableId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2555
	Pixmap pix = __PixmapVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2556
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2557
	if (pix) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2558
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2559
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2560
	    XFreePixmap(myDpy, pix);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2561
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2562
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2563
	    __cnt_bitmap--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2564
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2565
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2566
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2567
	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
  2568
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2569
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2570
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2571
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2572
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2573
destroyView:aViewOrNil withId:aWindowId
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2574
    XftFontDescription notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  2575
	XftFontDescription aboutToDestroyViewWithDevice:self id:aWindowId.
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2576
    ].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2577
    self primDestroyViewWithId:aWindowId.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2578
    self removeKnownView:aViewOrNil withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2579
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2580
48194c26a46c Initial revision
claus
parents:
diff changeset
  2581
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2582
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2583
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2584
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2585
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2586
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2587
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2588
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2589
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2590
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2591
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2592
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2593
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2594
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2595
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2596
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2597
				       __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2598
				       0, height, 0, colormap, NULL, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2599
				       XDPSDefaultTextBackstop,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2600
				       XDPSDefaultErrorProc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2601
				       NULL);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2602
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2603
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2604
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2605
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2606
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2607
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2608
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2609
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2610
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2611
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2612
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2613
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2614
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2615
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2616
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2617
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2618
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2619
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2620
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2621
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2622
	gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2623
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2624
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2625
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2626
	if (gc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2627
	    __cnt_gc++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2628
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2629
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2630
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2631
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2632
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2633
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2634
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2635
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2636
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2637
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2638
    "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
  2639
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2640
    ^ self gcFor:aDrawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2641
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2642
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2643
primCreateBitmapFromArray:anArray width:w height:h
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2644
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2645
154
claus
parents: 153
diff changeset
  2646
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2647
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2648
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2649
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2650
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2651
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2652
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2653
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2654
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2655
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2656
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2657
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2658
    static char reverseBitTable[256];
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  2659
    static int firstCall = 1;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2660
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2661
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2662
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2663
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2664
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2665
    if (! ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2666
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2667
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2668
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2669
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2670
    if (firstCall) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2671
	for (index=0; index < 256; index++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2672
	    int t = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2673
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2674
	    if (index & 128) t |=   1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2675
	    if (index &  64) t |=   2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2676
	    if (index &  32) t |=   4;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2677
	    if (index &  16) t |=   8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2678
	    if (index &   8) t |=  16;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2679
	    if (index &   4) t |=  32;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2680
	    if (index &   2) t |=  64;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2681
	    if (index &   1) t |= 128;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2682
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2683
	    reverseBitTable[index] = t;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2684
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2685
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2686
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2687
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2688
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2689
	newBitmap = (Pixmap)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2690
	b_width = __intVal(w);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2691
	b_height = __intVal(h);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2692
	bytesPerRow = (b_width + 7) / 8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2693
	nBytes = b_height * bytesPerRow;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2694
	if (nBytes < sizeof(fastBits)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2695
	    cp = b_bits = fastBits;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2696
	    allocatedBits = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2697
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2698
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2699
	    if (! cp) goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2700
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2701
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2702
	if (__isArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2703
	    index = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2704
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2705
	    for (row = b_height; row; row--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2706
		for (col = bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2707
		    num = *op++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2708
		    if (__isSmallInteger(num)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2709
			bits = __intVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2710
		    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2711
			bits = __longIntVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2712
			if (bits == 0) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2713
			    goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2714
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2715
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2716
		    *cp++ = reverseBitTable[bits & 0xFF];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2717
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2718
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2719
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2720
	    if (__isByteArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2721
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2722
		for (col = b_height*bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2723
		    *cp++ = reverseBitTable[*pBits++];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2724
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2725
	    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2726
		goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2727
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2728
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2729
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2730
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2731
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2732
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2733
					       (char *)b_bits,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2734
					       b_width, b_height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2735
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2736
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2737
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2738
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2739
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2740
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2741
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2742
fail: ;
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2743
	if (allocatedBits)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2744
	    free(allocatedBits);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2745
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2746
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2747
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2748
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2749
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2750
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2751
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
  2752
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2753
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2754
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2755
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2756
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2757
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2758
primDestroyViewWithId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2759
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2760
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2761
    if (! ISCONNECTED) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2762
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2763
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2764
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2765
    if (__isExternalAddress(aWindowId)) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2766
	Window win = __WindowVal(aWindowId);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2767
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2768
	if (win) {
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2769
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2770
	    ENTER_XLIB();
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2771
	    XDestroyWindow(myDpy, win);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2772
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2773
#ifdef COUNT_RESOURCES
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2774
	    __cnt_view--;
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2775
#endif
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2776
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2777
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2778
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2779
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2780
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2781
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2782
!XWorkstation methodsFor:'clipboard'!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2783
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2784
getPrimaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2785
    "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
  2786
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2787
    ^ primaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2788
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2789
    "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
  2790
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2791
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2792
primaryBufferAsString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2793
    "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
  2794
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
  2795
    ^ self class bufferAsString:self getPrimaryBuffer.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2796
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2797
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2798
setPrimaryBuffer:aString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2799
    "Sets the contents of PRIMARY selection."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2800
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2801
    primaryBuffer := aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2802
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2803
    "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
  2804
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2805
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2806
setPrimaryText:aString ownerView:aView
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2807
    "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
  2808
     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
  2809
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2810
    |s viewID|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2811
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2812
    self setPrimaryBuffer:aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2813
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2814
    s := aString ? ''.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2815
    s isString ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2816
	s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2817
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2818
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2819
    viewID := aView id.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2820
    viewID notNil ifTrue:[ "/ if the view is not already closed
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2821
	"/ for now - should add support to pass emphasis information too
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2822
	s := s string.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2823
	self setPrimaryText:s owner:viewID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2824
    ]
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2825
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2826
    "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
  2827
! !
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2828
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2829
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2830
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2831
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2832
    "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
  2833
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2834
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2835
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2836
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2837
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2838
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2839
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2840
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2841
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2842
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2843
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2844
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2845
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2846
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2847
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2848
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2849
				   &dummy, 0, &color.pixel, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2850
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2851
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2852
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2853
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2854
	    __cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2855
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2856
	    RETURN ( __MKSMALLINT(color.pixel) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2857
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2858
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2859
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2860
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2861
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2862
48194c26a46c Initial revision
claus
parents:
diff changeset
  2863
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
  2864
    "allocate a color with color name - return the color index (i.e. colorID).
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2865
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2866
     and the returned colorID is formed by simply packing the RGB values.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2867
     Don't use this method, colornames are mostly X specific."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2868
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2869
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2870
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2871
48194c26a46c Initial revision
claus
parents:
diff changeset
  2872
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2873
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2874
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2875
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2876
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2877
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2878
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2879
     && __isStringLike(aString)) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2880
	Display *dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2881
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2882
	colorname = (char *) __stringVal(aString);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2883
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2884
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2885
	ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2886
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2887
	LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2888
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2889
#ifdef QUICK_TRUE_COLORS
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2890
	    if (__INST(visualType) == @symbol(TrueColor)) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2891
		id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2892
		id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2893
		id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2894
		RETURN ( __MKSMALLINT(id) );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2895
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2896
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2897
	    ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2898
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2899
	    LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2900
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2901
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2902
	if (! ok) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2903
	    RETURN ( nil );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2904
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2905
#ifdef COUNT_RESOURCES
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2906
	__cnt_color++;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2907
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2908
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2909
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2910
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2911
    ^ 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
  2912
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2913
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2914
colorScaledRed:r scaledGreen:g scaledBlue:b
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2915
    "allocate a color with rgb values (0..16rFFFF)
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2916
     - return the color index (i.e. colorID).
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2917
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2918
     and the returned colorID is formed by simply packing the RGB values."
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2919
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2920
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2921
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2922
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2923
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2924
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2925
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2926
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2927
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2928
    if (__bothSmallInteger(r, g)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2929
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2930
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2931
	ecolor.red = __intVal(r);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2932
	ecolor.green= __intVal(g);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2933
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2934
#ifdef QUICK_TRUE_COLORS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2935
	if (__INST(visualType) == @symbol(TrueColor)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2936
	    id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2937
	    id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2938
	    id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2939
	    RETURN ( __MKSMALLINT(id) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2940
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2941
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2942
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2943
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2944
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2945
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2946
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2947
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2948
	if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2949
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2950
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2951
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2952
	__cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2953
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2954
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2955
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2956
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2957
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2958
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2959
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2960
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2961
    "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
  2962
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2963
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2964
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2965
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2966
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2967
     Display deviceColorValueToPercent:0
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2968
     Display deviceColorValueToPercent:16r8000
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2969
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2970
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2971
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2972
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2973
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2974
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2975
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2976
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2977
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2978
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2979
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2980
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2981
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2982
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2983
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2984
    if (__INST(visualType) == @symbol(TrueColor)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2985
	/* no need to do anything on TrueColor displays ... */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2986
	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
  2987
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2988
#endif
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2989
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2990
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2991
     * 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
  2992
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2993
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2994
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2995
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2996
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2997
    if (__isSmallInteger(colorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2998
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2999
	color = (long) __intVal(colorIndex);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3000
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3001
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3002
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3003
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3004
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3005
	__cnt_color--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3006
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3007
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3008
	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
  3009
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3010
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3011
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3012
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3013
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3014
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
  3015
    "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
  3016
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3017
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3018
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3019
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3020
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3021
    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
  3022
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3023
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3024
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3025
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3026
     && __isSmallInteger(index)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3027
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3028
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3029
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3030
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3031
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3032
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3033
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3034
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3035
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3036
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3037
	 * have to compensate for an error in X ?, which does not scale
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3038
	 * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3039
	 * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3040
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3041
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3042
	bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3043
	scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3044
	shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3045
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3046
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3047
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3048
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3049
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3050
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3051
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3052
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3053
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3054
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3055
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
  3056
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3057
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3058
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3059
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3060
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3061
    XColor color;
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3062
    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
  3063
    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
  3064
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3065
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3066
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  3067
     && __isStringLike(colorName)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3068
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3069
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3070
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3071
	if (XParseColor(dpy, DefaultColormap(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3072
			     (char *) __stringVal(colorName), &color)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3073
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3074
	     * have to compensate for an error in X ?, which does not scale
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3075
	     * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3076
	     * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3077
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3078
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3079
	    bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3080
	    scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3081
	    shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3082
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3083
	    /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3084
	    dr = color.red>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3085
	    dg = color.green>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3086
	    db = color.blue>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3087
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3088
	    sr = (dr / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3089
	    sg = (dg / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3090
	    sb = (db / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3091
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3092
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3093
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3094
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3095
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3096
    ^ super getScaledRGBFromName:colorName
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3097
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3098
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3099
	Screen current getScaledRGBFromName:'red'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3100
	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
  3101
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3102
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3103
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3104
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3105
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3106
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3107
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3108
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3109
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3110
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  3111
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3112
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3113
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3114
    [aStream atEnd] whileFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3115
	line := aStream nextLine.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3116
	line notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3117
	    "skip the r/g/b numbers"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3118
	    index := 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3119
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3120
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3121
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3122
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3123
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3124
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3125
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3126
	    colorName := line copyFrom:index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3127
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3128
		list add:colorName
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3129
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3130
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3131
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3132
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3133
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3134
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3135
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3136
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3137
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3138
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3139
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3140
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3141
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3142
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3143
    "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
  3144
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3145
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3146
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3147
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3148
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3149
    if (__isSmallInteger(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3150
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3151
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3152
    if (__isFloat(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3153
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3154
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3155
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3156
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3157
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3158
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3159
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
  3160
    "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
  3161
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3162
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3163
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3164
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3165
48194c26a46c Initial revision
claus
parents:
diff changeset
  3166
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3167
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3168
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3169
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3170
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3171
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3172
    if (__isSmallInteger(sred))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3173
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3174
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3175
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3176
    if (__isSmallInteger(sgreen))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3177
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3178
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3179
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3180
    if (__isSmallInteger(sblue))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3181
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3182
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3183
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3184
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3185
     && __isSmallInteger(index) && ok) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3186
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3187
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3188
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3189
	color.red = r;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3190
	color.green = g;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3191
	color.blue = b;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3192
	color.flags = DoRed | DoGreen | DoBlue;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3193
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3194
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3195
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3196
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3197
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3198
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3199
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3200
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3201
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3202
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3203
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3204
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3205
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3206
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3207
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3208
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3209
     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
  3210
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3211
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3212
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3213
    "/ 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
  3214
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3215
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3216
	#upLeftArrow            "/ XC_top_left_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3217
	#upRightHand            "/ XC_hand1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3218
	#upDownArrow            "/ XC_sb_v_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3219
	#leftRightArrow         "/ XC_sb_h_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3220
	#upLimitArrow           "/ XC_top_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3221
	#downLimitArrow         "/ XC_bottom_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3222
	#leftLimitArrow         "/ XC_left_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3223
	#rightLimitArrow        "/ XC_right_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3224
	#text                   "/ XC_xterm
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3225
	#upRightArrow           "/ XC_draft_large
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3226
	#leftHand               "/ XC_hand2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3227
	#questionMark           "/ XC_question_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3228
	#cross                  "/ XC_X_cursor
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3229
	#wait                   "/ XC_watch
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3230
	#crossHair              "/ XC_tcross
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3231
	#origin                 "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3232
	#topLeft                "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3233
	#corner                 "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3234
	#bottomRight            "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3235
	#topRight               "/ XC_ur_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3236
	#bottomLeft             "/ XC_ll_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3237
	#square                 "/ XC_dotbox
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3238
	#fourWay                "/ XC_fleur
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3239
	#crossCursor            "/ XC_X_cursor
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3240
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3241
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3242
    "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
  3243
    "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
  3244
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3245
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3246
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3247
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3248
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3249
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3250
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3251
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3252
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3253
    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
  3254
    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
  3255
    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
  3256
    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
  3257
    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
  3258
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3259
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3260
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3261
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3262
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3263
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3264
     && __bothSmallInteger(fgG, fgB)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3265
     && __bothSmallInteger(bgR, bgG)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3266
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3267
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3268
	fgcolor.red = __intVal(fgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3269
	fgcolor.green= __intVal(fgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3270
	fgcolor.blue = __intVal(fgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3271
	bgcolor.red = __intVal(bgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3272
	bgcolor.green= __intVal(bgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3273
	bgcolor.blue = __intVal(bgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3274
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3275
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3276
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3277
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3278
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3279
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  3280
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3281
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3282
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3283
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3284
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3285
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3286
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3287
     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
  3288
     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
  3289
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3290
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3291
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3292
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3293
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3294
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3295
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3296
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3297
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
  3298
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3299
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3300
    ^ self
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3301
	primCreateCursorSourceFormId:sourceForm id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3302
	maskFormId:maskForm id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3303
	hotX:hx hotY:hy
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3304
	width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3305
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3306
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3307
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3308
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3309
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3310
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3311
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3312
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3313
     * 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
  3314
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3315
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3316
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3317
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3318
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3319
    if (__isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3320
	Cursor curs = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3321
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3322
	if (curs) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3323
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3324
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3325
	    XFreeCursor(myDpy, curs);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3326
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3327
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3328
	    __cnt_cursor--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3329
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3330
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3331
	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
  3332
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3333
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3334
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3335
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3336
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3337
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3338
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3339
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3340
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3341
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3342
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3343
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3344
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3345
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3346
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3347
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3348
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3349
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3350
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3351
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3352
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3353
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3354
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3355
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3356
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3357
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3358
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3359
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3360
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3361
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3362
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3363
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3364
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3365
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3366
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3367
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3368
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3369
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3370
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3371
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3372
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3373
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3374
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3375
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3376
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3377
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3378
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3379
     && __bothSmallInteger(hx, hy)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3380
	fgColor.red = 0;        /* fg is black */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3381
	fgColor.green = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3382
	fgColor.blue = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3383
	bgColor.red = 0xFFFF;   /* bg is white */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3384
	bgColor.green = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3385
	bgColor.blue = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3386
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3387
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3388
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3389
	newCursor = XCreatePixmapCursor(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3390
				__PixmapVal(sourceId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3391
				__PixmapVal(maskId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3392
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3393
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3394
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3395
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3396
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3397
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3398
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3399
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3400
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3401
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3402
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3403
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3404
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3405
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3406
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3407
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3408
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3409
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3410
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3411
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3412
    "/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
  3413
    "/ 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
  3414
6873
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3415
%{  /* NOCONTEXT */
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3416
    if (shape == @symbol(upLeftArrow)) RETURN ( __MKSMALLINT(XC_top_left_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3417
    if (shape == @symbol(upRightHand)) RETURN (  __MKSMALLINT(XC_hand1) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3418
    if (shape == @symbol(upDownArrow)) RETURN (  __MKSMALLINT(XC_sb_v_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3419
    if (shape == @symbol(leftRightArrow)) RETURN (  __MKSMALLINT(XC_sb_h_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3420
    if (shape == @symbol(upLimitArrow)) RETURN (  __MKSMALLINT(XC_top_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3421
    if (shape == @symbol(downLimitArrow)) RETURN (  __MKSMALLINT(XC_bottom_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3422
    if (shape == @symbol(leftLimitArrow)) RETURN (  __MKSMALLINT(XC_left_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3423
    if (shape == @symbol(rightLimitArrow)) RETURN (  __MKSMALLINT(XC_right_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3424
    if (shape == @symbol(text)) RETURN (  __MKSMALLINT(XC_xterm) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3425
    if (shape == @symbol(upRightArrow)) RETURN (  __MKSMALLINT(XC_draft_large) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3426
    if (shape == @symbol(leftHand)) RETURN (  __MKSMALLINT(XC_hand2) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3427
    if (shape == @symbol(questionMark)) RETURN (  __MKSMALLINT(XC_question_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3428
    if (shape == @symbol(cross)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3429
    if (shape == @symbol(wait)) RETURN (  __MKSMALLINT(XC_watch) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3430
    if (shape == @symbol(crossHair)) RETURN (  __MKSMALLINT(XC_tcross) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3431
    if ((shape == @symbol(origin)) || (shape == @symbol(topLeft))) RETURN (  __MKSMALLINT(XC_ul_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3432
    if ((shape == @symbol(corner)) || (shape == @symbol(bottomRight))) RETURN ( __MKSMALLINT(XC_lr_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3433
    if (shape == @symbol(topRight)) RETURN (  __MKSMALLINT(XC_ur_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3434
    if (shape == @symbol(bottomLeft)) RETURN (  __MKSMALLINT(XC_ll_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3435
    if (shape == @symbol(square)) RETURN (  __MKSMALLINT(XC_dotbox) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3436
    if (shape == @symbol(fourWay)) RETURN (  __MKSMALLINT(XC_fleur) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3437
    if (shape == @symbol(crossCursor)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3438
%}.
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7416
diff changeset
  3439
"/    Logger info:'invalid cursorShape: %1' with:shape.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3440
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3441
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3442
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3443
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3444
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3445
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3446
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3447
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3448
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3449
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3450
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3451
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3452
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3453
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3454
	"/ DND can drop files, file, dir, links, dirLink and text
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3455
	"/ check for this.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3456
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3457
	dropObjects isCollection ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3458
	    dropColl := Array with:dropObjects
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3459
	] ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3460
	    dropColl := dropObjects
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3461
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3462
	anyFile := anyDir := anyText := anyOther := false.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3463
	dropColl do:[:aDropObject |
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3464
	    aDropObject isFileObject ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3465
		aDropObject theObject isDirectory ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3466
		    anyDir := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3467
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3468
		    anyFile := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3469
		]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3470
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3471
		aDropObject isTextObject ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3472
		    anyText := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3473
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3474
		    anyOther := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3475
		]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3476
	    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3477
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3478
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3479
	anyOther ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3480
	    "/ DND does not support this ...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3481
	    Logger info:'DND can only drop files or text'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3482
	    ^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3483
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3484
	anyText ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3485
	    (anyFile or:[anyDir]) ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3486
		"/ DND does not support mixed types
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3487
		Logger info:'DND cannot drop both files and text'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3488
		^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3489
	    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3490
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3491
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3492
	dropCollSize := dropColl size.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3493
	anyFile ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3494
	    dropType := #DndFiles.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3495
	    dropCollSize == 1 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3496
		dropType := #DndFile
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3497
	    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3498
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3499
	    anyDir ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3500
		dropType := #DndFiles.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3501
		dropCollSize == 1 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3502
		    dropType := #DndDir
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3503
		]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3504
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3505
		anyText ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3506
		    dropCollSize == 1 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3507
			dropType := #DndText
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3508
		    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3509
			"/ can only drop a single text object
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3510
			Logger info:'DND can only drop a single text'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3511
			^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3512
		    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3513
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3514
		    "/ mhmh ...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3515
		    Logger info:'DND cannot drop this'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3516
		    ^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3517
		]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3518
	    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3519
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3520
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3521
	dropTypeCode := self dndDropTypes indexOf:dropType.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3522
	dropTypeCode == 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3523
	    Logger info:'DND cannot drop this'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3524
	    ^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3525
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3526
	dropTypeCode := dropTypeCode - 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3527
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3528
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3529
	"/ place the selection inTo the DndSelection property
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3530
	"/ of the rootView ...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3531
	"/ ... need a single string, with 0-terminated parts.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3532
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3533
	strings := OrderedCollection new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3534
	sz := 0.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3535
	dropColl do:[:anObject |
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3536
	    |s o|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3537
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3538
	    o := anObject theObject.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3539
	    anObject isFileObject ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3540
		o := o pathName
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3541
	    ].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3542
	    s := o asString.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3543
	    strings add:s.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3544
	    sz := sz + (s size) + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3545
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3546
	val := String new:sz.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3547
	idx := 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3548
	strings do:[:aString |
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3549
	    |sz|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3550
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3551
	    sz := aString size.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3552
	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3553
	    idx := idx + sz.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3554
	    val at:idx put:(Character value:0).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3555
	    idx := idx + 1
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3556
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3557
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3558
	self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3559
	    setProperty:(self atomIDOf:#DndSelection)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3560
	    type:(self atomIDOf:#STRING)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3561
	    value:val
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3562
	    for:rootId.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3563
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3564
	^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3565
	    sendClientEvent:msgType
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3566
	    format:32
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3567
	    to:destinationId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3568
	    propagate:true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3569
	    eventMask:nil
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3570
	    window:destinationId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3571
	    data1:dropTypeCode
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3572
	    data2:0
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3573
	    data3:destinationId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3574
	    data4:nil
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3575
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3576
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3577
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3578
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3579
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3580
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  3581
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3582
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3583
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3584
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3585
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3586
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3587
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3588
	    DndUnknown      "/ 0
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3589
	    DndRawData      "/ 1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3590
	    DndFile         "/ 2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3591
	    DndFiles        "/ 3
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3592
	    DndText         "/ 4
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3593
	    DndDir          "/ 5
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3594
	    DndLink         "/ 6
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3595
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3596
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3597
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3598
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3599
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3600
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3601
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3602
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3603
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3604
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3605
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3606
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3607
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3608
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3609
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3610
	^ self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3611
	    dndDrop:aCollectionOfDropObjects
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3612
	    inWindowID:destinationId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3613
	    position:destinationPoint
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3614
	    rootPosition:rootPoint
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3615
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3616
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3617
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3618
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3619
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3620
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3621
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3622
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3623
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3624
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3625
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3626
clearRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3627
    "clear (fill with background) a rectangle. If any coordinate is not integer, an error is triggered."
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3628
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3629
    <context: #return>
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3630
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3631
    operationsUntilFlush notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3632
	operationsUntilFlush <= 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3633
	    self flush.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3634
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3635
	    operationsUntilFlush := operationsUntilFlush - 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3636
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3637
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3638
%{
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3639
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3640
    int w, h;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3641
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3642
    if (ISCONNECTED
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3643
     && __isExternalAddress(aDrawableId)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3644
     && __bothSmallInteger(x, y)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3645
     && __bothSmallInteger(width, height)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3646
	w = __intVal(width);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3647
	h = __intVal(height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3648
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3649
	 * need this check here: some servers simply dump core with bad args
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3650
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3651
	if ((w >= 0) && (h >= 0)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3652
	    ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3653
	    XClearArea(myDpy,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3654
			   __DrawableVal(aDrawableId),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3655
			   __intVal(x), __intVal(y), w, h, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3656
	    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3657
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3658
	RETURN ( self );
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3659
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3660
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3661
    "badGC, badDrawable or coordinates not integer"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3662
    self primitiveFailedOrClosedConnection
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3663
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3664
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3665
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
  3666
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3667
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3668
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3669
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3670
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3671
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3672
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3673
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3674
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3675
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3676
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3677
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3678
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3679
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3680
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3681
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3682
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3683
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3684
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3685
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3686
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3687
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3688
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3689
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3690
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3691
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3692
	int _sX, _sY, _w, _h, _dX, _dY;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3693
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3694
	_sX = __intVal(srcX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3695
	_sY = __intVal(srcY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3696
	_w = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3697
	_h = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3698
	_dX = __intVal(dstX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3699
	_dY = __intVal(dstY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3700
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3701
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3702
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3703
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3704
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3705
	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3706
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3707
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3708
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3709
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3710
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3711
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3712
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3713
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3714
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3715
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3716
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
  3717
    "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
  3718
     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
  3719
     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
  3720
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3721
     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
  3722
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3723
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3724
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3725
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3726
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3727
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3728
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3729
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3730
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3731
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3732
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3733
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3734
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3735
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3736
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3737
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3738
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3739
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3740
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3741
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3742
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3743
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3744
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3745
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3746
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3747
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3748
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3749
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3750
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3751
	XCopyArea(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3752
				__intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3753
				__intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3754
				__intVal(dstX), __intVal(dstY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3755
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3756
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3757
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3758
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3759
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3760
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3761
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3762
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3763
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3764
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3765
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3766
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
  3767
    "do a bit-blt, but only copy the low-bit plane;
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3768
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3769
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3770
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3771
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3772
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3773
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3774
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3775
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3776
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3777
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3778
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3779
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3780
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3781
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3782
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3783
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3784
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3785
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3786
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3787
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3788
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3789
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3790
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3791
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3792
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3793
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3794
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3795
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3796
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3797
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3798
	XCopyPlane(myDpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3799
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3800
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3801
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3802
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3803
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3804
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3805
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3806
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3807
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3808
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3809
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3810
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3811
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3812
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
  3813
    "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
  3814
     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
  3815
     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
  3816
     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
  3817
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3818
     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
  3819
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3820
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3821
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3822
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3823
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3824
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3825
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3826
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3827
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3828
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3829
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3830
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3831
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3832
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3833
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3834
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3835
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3836
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3837
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3838
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3839
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3840
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3841
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3842
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3843
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3844
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3845
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3846
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3847
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3848
	XCopyPlane(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3849
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3850
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3851
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3852
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3853
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3854
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3855
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3856
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3857
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3858
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3859
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3860
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3861
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3862
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3863
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
  3864
    "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
  3865
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3866
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3867
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3868
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3869
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3870
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3871
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3872
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3873
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3874
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3875
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3876
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3877
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3878
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3879
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3880
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3881
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3882
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3883
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3884
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3885
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3886
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3887
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3888
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3889
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3890
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3891
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3892
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3893
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3894
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3895
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3896
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3897
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3898
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3899
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3900
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3901
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3902
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3903
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3904
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3905
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3906
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3907
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3908
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3909
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3910
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3911
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3912
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3913
	 * need this check here: some servers simply dump core with bad args
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3914
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3915
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3916
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3917
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3918
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3919
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3920
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3921
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3922
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3923
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3924
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3925
    "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
  3926
     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
  3927
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3928
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3929
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3930
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3931
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
  3932
    "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
  3933
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3934
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3935
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3936
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3937
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3938
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3939
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3940
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3941
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3942
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3943
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3944
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3945
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3946
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3947
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3948
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3949
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3950
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3951
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3952
     && __bothSmallInteger(x1, y1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3953
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3954
	int ix0, iy0, ix1, iy1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3955
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3956
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3957
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3958
	ix0 = __intVal(x0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3959
	iy0 = __intVal(y0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3960
	ix1 = __intVal(x1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3961
	iy1 = __intVal(y1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3962
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3963
	/* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3964
	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3965
	else if (ix0 < -0x8000) ix0 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3966
	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3967
	else if (iy0 < -0x8000) iy0 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3968
	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3969
	else if (ix1 < -0x8000) ix1 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3970
	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3971
	else if (iy1 < -0x8000) iy1 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3972
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3973
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3974
	if ((ix0 == ix1) && (iy0 == iy1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3975
	    /* little bit shorter X-lib message (better with slow connections...) */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3976
	    XDrawPoint(dpy, win, gc, ix0, iy0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3977
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3978
	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3979
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3980
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3981
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3982
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3983
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3984
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3985
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3986
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3987
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3988
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
  3989
    "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
  3990
     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
  3991
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3992
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3993
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3994
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3995
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3996
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3997
    (noY := yValues size) < 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3998
	^ self
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3999
    ].
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4000
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4001
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4002
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4003
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4004
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4005
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4006
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4007
    ].
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4008
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4009
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4010
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4011
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4012
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4013
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4014
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4015
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4016
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4017
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4018
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4019
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4020
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4021
     && __isExternalAddress(aDrawableId) ) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4022
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4023
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4024
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4025
	if( __isSmallInteger(scaleY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4026
	    sY = (float) __intVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4027
	else if (__isFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4028
	    sY = __floatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4029
	else if (__isShortFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4030
	    sY = __shortFloatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4031
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4032
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4033
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4034
	    sY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4035
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4036
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4037
	if( __isSmallInteger(transY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4038
	    tY = (float) __intVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4039
	else if (__isFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4040
	    tY = __floatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4041
	else if (__isShortFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4042
	    tY = __shortFloatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4043
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4044
	    t = __SSEND0(transY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4045
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4046
	    tY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4047
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4048
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4049
	if( __isSmallInteger(startX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4050
	    x = (float) __intVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4051
	else if (__isFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4052
	    x = __floatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4053
	else if (__isShortFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4054
	    x = __shortFloatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4055
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4056
	    t = __SSEND0(startX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4057
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4058
	    x = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4059
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4060
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4061
	if( __isSmallInteger(stepX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4062
	    step = (float) __intVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4063
	else if (__isFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4064
	    step = __floatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4065
	else if (__isShortFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4066
	    step = __shortFloatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4067
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4068
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4069
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4070
	    step = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4071
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4072
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4073
	num = __intVal( noY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4074
	if( num > 200 ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4075
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4076
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4077
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4078
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4079
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4080
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4081
	for( i = 0; i < num; ++i ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4082
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4083
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4084
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4085
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4086
	    if( __isFloat(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4087
		y = __floatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4088
	    else if( __isSmallInteger(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4089
		y = (float) __intVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4090
	    else if( __isShortFloat( yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4091
		y = __shortFloatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4092
	    else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4093
		t = __SSEND0(yA, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4094
		if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4095
		y = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4096
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4097
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4098
	    px = (int) (x + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4099
	    py = (int) ((y * sY) + tY + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4100
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4101
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4102
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4103
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4104
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4105
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4106
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4107
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4108
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4109
	    x = x + step;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4110
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4111
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4112
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4113
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4114
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4115
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4116
	if( mustFree ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4117
	    free( points );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4118
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4119
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4120
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4121
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4122
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4123
    if( mustFree )
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4124
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4125
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4126
    ^ 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
  4127
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  4128
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4129
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4130
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4131
displayPointX:x y:y in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4132
    "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
  4133
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4134
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4135
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4136
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4137
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4138
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4139
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4140
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4141
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4142
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4143
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4144
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4145
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4146
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4147
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4148
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4149
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4150
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4151
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4152
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4153
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4154
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4155
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4156
	px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4157
	py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4158
	if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4159
	else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4160
	if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4161
	else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4162
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4163
	XDrawPoint(myDpy, win, gc, px, py);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4164
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4165
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4166
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4167
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4168
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4169
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4170
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4171
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4172
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4173
    "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
  4174
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4175
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4176
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4177
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4178
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4179
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4180
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4181
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4182
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4183
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4184
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4185
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4186
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4187
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4188
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4189
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4190
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4191
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4192
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4193
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4194
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4195
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4196
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4197
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4198
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4199
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4200
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4201
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4202
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4203
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4204
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4205
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4206
	 * avoid a (slow) malloc, if the number of points is small
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4207
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4208
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4209
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4210
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4211
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4212
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4213
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4214
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4215
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4216
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4217
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4218
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4219
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4220
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4221
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4222
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4223
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4224
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4225
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4226
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4227
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4228
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4229
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4230
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4231
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4232
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4233
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4234
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4235
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4236
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4237
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4238
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4239
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4240
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4241
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4242
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4243
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4244
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4245
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4246
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4247
    if (mustFree)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4248
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4249
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4250
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4251
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4252
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4253
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4254
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
  4255
    "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
  4256
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4257
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4258
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4259
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4260
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4261
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4262
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4263
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4264
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4265
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4266
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4267
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4268
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4269
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4270
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4271
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4272
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4273
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4274
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4275
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4276
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4277
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4278
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4279
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4280
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4281
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4282
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4283
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4284
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4285
	 * need this check here: some servers simply dump core with bad args
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4286
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4287
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4288
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4289
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4290
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4291
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4292
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4293
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4294
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4295
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4296
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4297
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4298
	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4299
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4300
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4301
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4302
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4303
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4304
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4305
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4306
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4307
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4308
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
  4309
    "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
  4310
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4311
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4312
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4313
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4314
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4315
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4316
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4317
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4318
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4319
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4320
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4321
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4322
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4323
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4324
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4325
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4326
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4327
    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
  4328
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4329
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4330
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4331
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4332
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4333
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4334
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4335
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4336
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4337
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4338
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4339
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4340
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4341
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4342
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4343
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4344
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4345
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4346
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4347
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4348
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4349
		RETURN (self);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4350
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4351
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4352
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4353
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4354
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4355
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4356
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4357
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4358
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4359
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4360
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4361
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4362
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4363
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4364
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4365
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4366
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4367
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4368
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4369
	    cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4370
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4371
	    cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4372
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4373
	    if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4374
		n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4375
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4376
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4377
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4378
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4379
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4380
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4381
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4382
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4383
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4384
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4385
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4386
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4387
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4388
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4389
	    /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4390
	    if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4391
		n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4392
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4393
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4394
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4395
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4396
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4397
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4398
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4399
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4400
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4401
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4402
		    if (l > lMax) l = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4403
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4404
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4405
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4406
		     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4407
		     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4408
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4409
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4410
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4411
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4412
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4413
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4414
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4415
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4416
		    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4417
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4418
		    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4419
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4420
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4421
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4422
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4423
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4424
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4425
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4426
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4427
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4428
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4429
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4430
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4431
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4432
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4433
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4434
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4435
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4436
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4437
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4438
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4439
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4440
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4441
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4442
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4443
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4444
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4445
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4446
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4447
	    /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4448
	    if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4449
		n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4450
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4451
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4452
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4453
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4454
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4455
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4456
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4457
		    int32 *ip;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4458
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4459
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4460
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4461
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4462
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4463
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4464
		     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4465
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4466
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4467
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4468
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4469
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4470
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4471
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4472
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4473
			int32 codePoint = ((int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4474
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4475
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4476
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4477
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4478
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4479
			cp2[i].byte2 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4480
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4481
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4482
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4483
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4484
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4485
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4486
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4487
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4488
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4489
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4490
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4491
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4492
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4493
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4494
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4495
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4496
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4497
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4498
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4499
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4500
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4501
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4502
	self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4503
	     from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4504
	^ self.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4505
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4506
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4507
    "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
  4508
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4509
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4510
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4511
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
  4512
    "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
  4513
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4514
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4515
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4516
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4517
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4518
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4519
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4520
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4521
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4522
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4523
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4524
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4525
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4526
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4527
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4528
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4529
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4530
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4531
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4532
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4533
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4534
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4535
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4536
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4537
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4538
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4539
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4540
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4541
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4542
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4543
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4544
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4545
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4546
	cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4547
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4548
	if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4549
	    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4550
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4551
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4552
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4553
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4554
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4555
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4556
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4557
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4558
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4559
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4560
	cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4561
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4562
	cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4563
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4564
	if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4565
	    n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4566
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4567
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4568
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4569
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4570
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4571
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4572
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4573
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4574
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4575
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4576
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4577
	/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4578
	if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4579
	    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4580
		char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4581
		unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4582
	    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4583
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4584
	    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4585
	    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4586
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4587
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4588
	    if (n > lMax) n = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4589
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4590
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4591
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4592
	     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4593
	     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4594
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4595
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4596
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4597
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4598
	     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4599
	     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4600
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4601
	    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4602
	    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4603
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4604
	    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4605
		if (n <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4606
		    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4607
		} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4608
		    cp2 = (XChar2b *)(malloc(n * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4609
		    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4610
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4611
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4612
		for (i=0; i<n; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4613
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4614
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4615
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4616
		cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4617
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4618
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4619
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4620
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4621
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4622
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4623
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4624
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4625
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4626
	    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4627
		free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4628
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4629
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4630
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4631
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4632
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4633
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4634
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4635
    ^ 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
  4636
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4637
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4638
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4639
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4640
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4641
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4642
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4643
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4644
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4645
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4646
    "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
  4647
     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
  4648
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4649
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4650
     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
  4651
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4652
     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
  4653
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4654
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4655
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4656
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4657
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4658
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4659
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4660
    "/ 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
  4661
    "/ 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
  4662
    "/ 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
  4663
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4664
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4665
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4666
	fmt := self supportedImageFormatForDepth:4.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4667
	fmt isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4668
	    self primitiveFailed. "/ cannot represent this image
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4669
	    ^ nil
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4670
	].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4671
	wantedPadding := fmt at:#padding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4672
	wantedPadding > givenPadding ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4673
	    bits := self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4674
			    repadBits:givenBits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4675
			    width:imageWidth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4676
			    height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4677
			    depth:imageDepth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4678
			    from:givenPadding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4679
			    to:wantedPadding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4680
	    padding := wantedPadding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4681
	]
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4682
    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4683
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4684
    self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4685
	drawBits:bits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4686
	msb:true bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4687
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4688
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4689
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4690
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4691
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4692
	with:aGCId
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4693
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4694
    "Modified: / 11-04-2017 / 18:50:32 / cg"
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4695
!
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4696
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4697
drawBits:bits msb:msb bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4698
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4699
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4700
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4701
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4702
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4703
	with:aGCId
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4704
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4705
    "draw a bitImage which has depth id, width iw and height ih into
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4706
     the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4707
     Individual source pixels have bitsPerPixel bits, allowing to draw
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4708
     depth and pixel-units to be different.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4709
     It has to be checked elsewhere, that the server can do it with the given
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4710
     depth - otherwise, primitive failure will be signalled.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4711
     Also it is assumed, that the colormap is setup correctly and the
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4712
     colors are allocated - otherwise the colors may be wrong."
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4713
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4714
    operationsUntilFlush notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4715
	operationsUntilFlush <= 0 ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4716
	    self flush.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4717
	] ifFalse:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4718
	    operationsUntilFlush := operationsUntilFlush - 1.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4719
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4720
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4721
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4722
     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
  4723
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4724
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4725
    (self
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4726
	primDrawBits:bits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4727
	bitsPerPixel:bitsPerPixel
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4728
	depth:imageDepth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4729
	msb:msb
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4730
	padding:padding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4731
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4732
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4733
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4734
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4735
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4736
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4737
    ifFalse:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4738
	"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4739
	 also happens, if a segmentation violation occurs in the
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4740
	 XPutImage ...
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4741
	"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4742
	self primitiveFailedOrClosedConnection
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4743
    ].
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4744
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4745
    "Created: / 11-04-2017 / 18:49:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4746
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4747
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  4748
fillArcX:x y:y width:width height:height from:startAngle angle:angle
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4749
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4750
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4751
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4752
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4753
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4754
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4755
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4756
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4757
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4758
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4759
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4760
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4761
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4762
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4763
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4764
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4765
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4766
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4767
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4768
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4769
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4770
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4771
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4772
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4773
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4774
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4775
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4776
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4777
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4778
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4779
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4780
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4781
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4782
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4783
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4784
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4785
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4786
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4787
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4788
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4789
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4790
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4791
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4792
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4793
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4794
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4795
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4796
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4797
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4798
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4799
	 * need this check here: some servers simply dump core with bad args
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4800
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4801
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4802
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4803
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4804
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4805
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4806
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4807
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4808
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4809
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4810
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4811
    "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
  4812
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4813
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4814
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4815
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4816
48194c26a46c Initial revision
claus
parents:
diff changeset
  4817
fillPolygon:aPolygon in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4818
    "fill a polygon given by its points.
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4819
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4820
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4821
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4822
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4823
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4824
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4825
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4826
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4827
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4828
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4829
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4830
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4831
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4832
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  4833
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4834
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4835
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4836
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4837
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4838
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4839
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4840
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4841
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4842
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4843
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4844
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4845
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4846
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4847
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4848
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4849
	if (num < 3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4850
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4851
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4852
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4853
	 * avoid (slow) malloc, if not many points
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4854
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4855
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4856
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4857
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4858
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4859
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4860
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4861
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4862
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4863
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4864
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4865
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4866
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4867
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4868
	    points[i].x = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4869
	    points[i].y = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4870
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4871
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4872
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4873
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4874
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4875
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4876
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4877
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4878
fail: ;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4879
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4880
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4881
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4882
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4883
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4884
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4885
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4886
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4887
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
  4888
    "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
  4889
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4890
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4891
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4892
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4893
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4894
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4895
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4896
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4897
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4898
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4899
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4900
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4901
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4902
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4903
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4904
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4905
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4906
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4907
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4908
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4909
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4910
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4911
	 * need this check here: some servers simply dump core with bad args
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4912
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4913
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4914
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4915
	    XFillRectangle(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4916
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4917
			   __intVal(x), __intVal(y), w, h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4918
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4919
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4920
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4921
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4922
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4923
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4924
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4925
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4926
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4927
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4928
    msb:msb masks:maskArray padding:bitPadding
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4929
    extent:imageExtent sourceOrigin:srcOrg
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4930
    into:aDrawableId
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4931
    destinationOrigin:dstOrg extent:dstExtent
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4932
    with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4933
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4934
    <context: #return>
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4935
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4936
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4937
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4938
    imageWidth := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4939
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4940
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4941
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4942
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4943
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4944
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4945
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4946
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4947
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4948
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4949
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4950
    "since XPutImage may allocate huge amount of stack space
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4951
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4952
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4953
%{  /* UNLIMITEDSTACK */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4954
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4955
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4956
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4957
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4958
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4959
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4960
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4961
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4962
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4963
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4964
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4965
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4966
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4967
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4968
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4969
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4970
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4971
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4972
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4973
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4974
     && __isSmallInteger(bm)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4975
     && __isByteArrayLike(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4976
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4977
	int pad = __intVal(bitPadding);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4978
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4979
	gc = __GCVal(aGCId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4980
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4981
	if (! gc || !win)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4982
	    goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4983
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4984
	console_printf("args ok\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4985
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4986
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4987
	image.width = imgWdth = __intVal(imageWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4988
	image.height = __intVal(imageHeight);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4989
	image.xoffset = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4990
	image.format = ZPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4991
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4992
	image.bitmap_unit = 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4993
	image.bitmap_bit_order = MSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4994
	image.bitmap_pad = pad;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4995
	image.depth = __intVal(imageDepth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4996
	image.bits_per_pixel = __intVal(bitsPerPixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4997
	image.red_mask = __intVal(rm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4998
	image.green_mask = __intVal(gm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4999
	image.blue_mask = __intVal(bm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5000
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5001
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5002
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5003
	switch (image.bits_per_pixel) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5004
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5005
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5006
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5007
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5008
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5009
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5010
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5011
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5012
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5013
	    default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5014
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5015
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5016
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5017
		goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5018
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5019
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5020
	/* ENTER_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5021
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5022
					__intVal(dstx), __intVal(dsty),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5023
					__intVal(w), __intVal(h));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5024
	/* LEAVE_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5025
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5026
	RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5027
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5028
#ifdef ARGDEBUG
8061
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5029
    if (! __isExternalAddress(aGCId)) console_printf("GC\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5030
    if (! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5031
    if (! __isSmallInteger(srcx)) console_printf("srcx\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5032
    if (! __isSmallInteger(srcy)) console_printf("srcy\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5033
    if (! __isSmallInteger(dstx)) console_printf("dstx\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5034
    if (! __isSmallInteger(dsty)) console_printf("dsty\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5035
    if (! __isSmallInteger(w)) console_printf("w\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5036
    if (! __isSmallInteger(h)) console_printf("h\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5037
    if (! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5038
    if (! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5039
    if (! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5040
    if (! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5041
    if (! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5042
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5043
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5044
fail: ;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5045
%}
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5046
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5047
    ^ false
8061
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5048
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5049
    "Modified: / 08-08-2017 / 14:16:05 / cg"
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5050
!
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5051
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5052
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5053
    msb:msb padding:bitPadding
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5054
    width:imageWidth height:imageHeight
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5055
    x:srcx y:srcy
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5056
    into:aDrawableId
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5057
    x:dstx y:dsty
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5058
    width:w height:h
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5059
    with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5060
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5061
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5062
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5063
    "since XPutImage may allocate huge amount of stack space
132
claus
parents: 129
diff changeset
  5064
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  5065
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5066
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5067
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5068
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5069
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5070
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5071
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5072
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5073
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5074
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  5075
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5076
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5077
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5078
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5079
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5080
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5081
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5082
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5083
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5084
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  5085
     && __isSmallInteger(bitPadding)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5086
     && __isByteArrayLike(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5087
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5088
	int pad = __intVal(bitPadding);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5089
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5090
	gc = __GCVal(aGCId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5091
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5092
	if (! gc || !win)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5093
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5094
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5095
	console_printf("args ok\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5096
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5097
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5098
	image.width = imgWdth = __intVal(imageWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5099
	image.height = __intVal(imageHeight);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5100
	image.xoffset = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5101
	image.format = ZPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5102
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5103
	image.bitmap_unit = 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5104
	image.bitmap_bit_order = MSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5105
	image.bitmap_pad = pad;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5106
	image.depth = __intVal(imageDepth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5107
	image.bits_per_pixel = __intVal(bitsPerPixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5108
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5109
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5110
	image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5111
	*/
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5112
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5113
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5114
	switch (image.bits_per_pixel) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5115
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5116
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5117
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5118
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5119
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5120
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5121
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5122
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5123
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5124
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5125
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5126
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5127
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5128
		goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5129
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5130
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5131
	image.red_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5132
	image.green_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5133
	image.blue_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5134
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5135
	/* ENTER_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5136
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5137
					__intVal(dstx), __intVal(dsty),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5138
					__intVal(w), __intVal(h));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5139
	/* LEAVE_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5140
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5141
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5142
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5143
#ifdef ARGDEBUG
8062
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5144
    if (! __isExternalAddress(aGCId)) console_printf("GC\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5145
    if (! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5146
    if (! __isSmallInteger(srcx)) console_printf("srcx\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5147
    if (! __isSmallInteger(srcy)) console_printf("srcy\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5148
    if (! __isSmallInteger(dstx)) console_printf("dstx\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5149
    if (! __isSmallInteger(dsty)) console_printf("dsty\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5150
    if (! __isSmallInteger(w)) console_printf("w\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5151
    if (! __isSmallInteger(h)) console_printf("h\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5152
    if (! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5153
    if (! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5154
    if (! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5155
    if (! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5156
    if (! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5157
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5158
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5159
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5160
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  5161
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5162
    ^ false
8062
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5163
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5164
    "Modified: / 08-08-2017 / 14:16:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5165
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  5166
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5167
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5168
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5169
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
  5170
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5171
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5172
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5173
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5174
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5175
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5176
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
  5177
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5178
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5179
    |logicalButton clickPosition|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5180
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5181
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5182
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5183
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5184
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5185
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5186
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5187
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5188
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5189
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5190
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5191
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  5192
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  5193
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  5194
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5195
      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
  5196
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5197
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5198
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5199
    logicalButton isInteger ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5200
	buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5201
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5202
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5203
    clickPosition := x @ y.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5204
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5205
    (multiClickTimeDelta notNil
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5206
     and:[lastButtonPressTime notNil
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5207
     and:[time < (lastButtonPressTime + multiClickTimeDelta)
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5208
     and:[(clickPosition dist:lastButtonPressPosition) < 6]]]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5209
	lastButtonPressTime := time.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5210
	lastButtonPressPosition := clickPosition.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5211
	self buttonMultiPress:logicalButton x:x y:y view:view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5212
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5213
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5214
    lastButtonPressTime := time.
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5215
    lastButtonPressPosition := clickPosition.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5216
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5217
    view isNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5218
	"/ event arrived, after I destroyed it myself
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5219
	^ self
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5220
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5221
    (logicalButton == 1 and:[activateOnClick == true]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5222
	"/ don't raise above an active popup view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5223
	(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5224
	    view topView raise.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5225
	]
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5226
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5227
    self buttonPress:logicalButton x:x y:y view:view
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5228
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5229
    "Modified: / 09-05-2017 / 10:33:01 / stefan"
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5230
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5231
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5232
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
  5233
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5234
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5235
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5236
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5237
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5238
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5239
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5240
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5241
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5242
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5243
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5244
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5245
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5246
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5247
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5248
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5249
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5250
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5251
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5252
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5253
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5254
    logicalButton isInteger ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5255
	buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5256
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5257
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5258
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5259
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5260
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5261
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5262
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5263
    targetView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5264
	"targetView is gone? Anyway, cannot do anything with this event..."
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5265
	^ self.
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5266
    ].
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5267
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5268
    "DND drag&drop protocol"
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5269
    (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5270
	self dndMessage:nil data:data view:targetView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5271
	^ self.
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5272
    ].
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5273
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5274
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5275
    "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
  5276
    sensor notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5277
	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
  5278
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5279
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5280
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5281
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5282
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5283
configure:view relativeTo:anotherViewId x:x y:y width:w height:h borderWidth:borderWidth above:aboveViewId overrideRedirect:overrideBool
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5284
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5285
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5286
"/    anotherViewId notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5287
"/        |parentViewOrSelf|
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5288
"/        parentViewOrSelf := self viewFromId:anotherViewId.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5289
"/        parentViewOrSelf notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5290
"/        ].
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5291
"/     ].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5292
    self configureX:x y:y width:w height:h view:view.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5293
    aboveViewId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5294
	|aboveView|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5295
	aboveView := self viewFromId:aboveViewId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5296
	aboveView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5297
	    "view is now on the top of the window stack"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5298
	    self coveredBy:view view:aboveView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5299
	].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5300
     ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5301
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5302
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5303
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
  5304
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5305
    view isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5306
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5307
	^ self
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5308
    ].
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5309
    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
  5310
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5311
    "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
  5312
    "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
  5313
!
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5314
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5315
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
  5316
    "handle a drag&drop protocol message"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5317
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5318
    |sensor property dropType dropValue names i1 i2 propertyType|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5319
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5320
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5321
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5322
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5323
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5324
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5325
    property := self
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5326
	getProperty:(self atomIDOf:#DndSelection)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5327
	from:rootId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5328
	delete:false.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5329
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5330
    propertyType := property key.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5331
    dropValue := property value.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5332
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5333
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5334
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5335
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5336
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5337
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5338
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5339
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5340
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5341
    dropType == #DndFiles ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5342
	"/ actually, a list of fileNames
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5343
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5344
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5345
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5346
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5347
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5348
	names := OrderedCollection new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5349
	i1 := 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5350
	[i1 ~~ 0] whileTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5351
	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5352
	    i2 ~~ 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5353
		names add:(dropValue copyFrom:i1 to:(i2-1)).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5354
		i1 := i2 + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5355
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5356
		i1 := i2
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5357
	    ].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5358
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5359
	dropValue := names.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5360
	dropValue := dropValue collect:[:nm | nm asFilename].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5361
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5362
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5363
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5364
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5365
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5366
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5367
	dropValue := dropValue asFilename.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5368
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5369
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5370
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5371
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5372
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5373
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5374
	dropValue := dropValue asFilename.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5375
	dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5376
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5377
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5378
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5379
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5380
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5381
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5382
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5383
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5384
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5385
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5386
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5387
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5388
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5389
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5390
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5391
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5392
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5393
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5394
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5395
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  5396
    ] ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5397
	Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5398
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5399
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5400
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5401
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5402
    "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
  5403
    sensor notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5404
	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
  5405
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5406
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5407
    "Created: 4.4.1997 / 17:59:37 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5408
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5409
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5410
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
  5411
    "forward an expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5412
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5413
    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
  5414
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5415
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5416
focusIn:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5417
    "a view got the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5418
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5419
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5420
	"mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5421
	self focusInView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5422
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5423
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5424
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5425
focusOut:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5426
    "a view lost the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5427
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5428
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5429
	"mode NotifyGrab is set for pseudo-focus-changes, when a view grabs the keyboard"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5430
	self focusOutView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5431
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5432
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5433
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5434
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
  5435
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5436
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5437
    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
  5438
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5439
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5440
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
  5441
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5442
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5443
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5444
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5445
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5446
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5447
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5448
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5449
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5450
    key isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5451
	"/ happens sometimes on some systems
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5452
	"/ (alt-graph on sun has no keysym)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5453
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5454
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5455
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5456
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5457
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5458
    "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
  5459
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5460
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5461
    self keyPress:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5462
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5463
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5464
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
  5465
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5466
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5467
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5468
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5469
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5470
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5471
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5472
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5473
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5474
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5475
    key isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5476
	"/ happens sometimes on some systems
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5477
	"/ (alt-graph on sun has no keysym)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5478
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5479
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5480
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5481
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5482
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5483
    "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
  5484
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5485
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5486
    self keyRelease:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5487
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5488
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5489
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5490
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5491
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5492
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5493
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5494
	self refreshKeyboardMapping:eB.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5495
	"Maybe some of our modifiers have been changed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5496
	self initializeModifierMappings.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5497
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5498
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5499
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5500
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5501
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
  5502
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5503
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5504
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5505
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5506
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5507
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5508
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5509
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5510
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5511
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5512
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5513
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5514
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5515
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
  5516
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5517
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5518
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5519
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5520
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5521
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5522
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5523
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5524
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5525
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5526
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5527
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5528
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5529
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
  5530
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5531
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5532
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5533
    |selectionFetcher|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5534
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5535
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5536
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5537
	"event arrived, after aView has been destroyed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5538
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5539
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5540
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5541
"/    '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
  5542
"/    aView propertyChange:atom state:aSymbol.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5543
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5544
    "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
  5545
     be interested (for now, only XEmbedSiteView is)"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5546
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5547
    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
  5548
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5549
    aSymbol ~~ #newValue ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5550
	"I am not interested in delete notifications"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5551
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5552
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5553
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5554
    selectionFetcher notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5555
	selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5556
    ].
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5557
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5558
    "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
  5559
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5560
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5561
selectionClear:aView selection:selectionID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5562
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5563
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5564
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5565
    |selectionFetcher|
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5566
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5567
    lastEventTime := time.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5568
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5569
    selectionHandlers notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5570
	selectionHandlers do:[:eachHandler |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5571
	    eachHandler selectionClear:selectionID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5572
	]
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5573
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5574
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5575
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5576
	"event arrived, after aView has been destroyed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5577
	^ self
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5578
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5579
    selectionFetcher := self findSelectionFetcher:aView id.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5580
    selectionFetcher notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5581
	selectionFetcher message:thisContext message.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5582
    ].
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5583
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5584
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5585
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
  5586
    "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
  5587
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5588
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5589
    |selectionFetcher|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5590
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5591
"/    Transcript show:'selectionNotify selID:'.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5592
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5593
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5594
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5595
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5596
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5597
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5598
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5599
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5600
    lastEventTime := time.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5601
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5602
    aView isNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5603
	"event arrived, after aView has been destroyed"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5604
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5605
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5606
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5607
    selectionFetcher notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5608
	selectionFetcher message:thisContext message.
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5609
    ].
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5610
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5611
    "Modified (format): / 14-03-2017 / 16:31:20 / cg"
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5612
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5613
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5614
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5615
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5616
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5617
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5618
    |selection property bufferGetSelector responseTargetID selectionTime|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5619
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5620
"/'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5621
"/' Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5622
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5623
    lastEventTime := time.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5624
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5625
    "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
  5626
    selectionID == primaryAtom ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5627
	bufferGetSelector := #getPrimaryBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5628
	selectionTime := primarySelectionTime.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5629
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5630
	bufferGetSelector := #getCopyBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5631
	selectionTime := clipboardSelectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5632
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5633
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5634
    (targetID == (self atomIDOf:#TIMESTAMP)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5635
	"the other view wants to know when we acquired ownership of the selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5636
	responseTargetID := self atomIDOf:#INTEGER.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5637
	selection := selectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5638
    ] ifFalse:[(targetID == (self atomIDOf:#TARGETS)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5639
	"the other view wants to know which targets we support"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5640
	responseTargetID := self atomIDOf:#ATOM.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5641
	selection := self supportedTargetAtoms.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5642
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5643
	selection := self selectionBuffer:bufferGetSelector as:targetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5644
	responseTargetID := selection key.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5645
	selection := selection value.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5646
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5647
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5648
"/'Send selection: ' print. selection printCR.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5649
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5650
    property := propertyID.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5651
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5652
    selection isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5653
	"sending property None tells the client,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5654
	 that I could not convert"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5655
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5656
	property := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5657
	responseTargetID := targetID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5658
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5659
	property == 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5660
	    "Support old (obsolete) clients requesting a None property.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5661
	     Set the propertyID to the targetID"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5662
	    property := responseTargetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5663
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5664
	self setProperty:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5665
	     type:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5666
	     value:selection
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5667
	     for:requestorID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5668
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5669
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5670
    self sendNotifySelection:selectionID
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5671
	 property:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5672
	 target:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5673
	 time:time
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5674
	 to:requestorID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5675
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5676
    "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
  5677
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5678
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5679
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5680
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5681
    aView notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5682
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5683
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5684
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5685
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  5686
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5687
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5688
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5689
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5690
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5691
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5692
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5693
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5694
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5695
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5696
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5697
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5698
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5699
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5700
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5701
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5702
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5703
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5704
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5705
	^ self
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5706
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5707
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5708
    "/ aView colorMapChange
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5709
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5710
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5711
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
  5712
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5713
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5714
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5715
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5716
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5717
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5718
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5719
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5720
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5721
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5722
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5723
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5724
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5725
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5726
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5727
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5728
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5729
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5730
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5731
    "/ aView mapRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5732
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5733
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5734
reparentedView:aView parentId:parentId x:x y:y
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5735
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5736
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5737
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5738
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5739
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5740
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5741
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5742
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5743
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5744
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5745
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  5746
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5747
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5748
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5749
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5750
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5751
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5752
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5753
			 KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5754
			 PointerMotionMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5755
			 EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5756
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5757
			 PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5758
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5759
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5760
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5761
dispatchEvent:evArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5762
    "a raw event array as coming from the low level C code is converted
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5763
     to a message send here.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5764
     Also, the windowID from the event array is mapped to a view object."
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5765
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5766
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5767
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5768
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5769
    viewId notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5770
	viewId = lastId ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5771
	    view := lastView
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5772
	] ifFalse:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5773
	    view := self viewFromId:viewId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5774
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5775
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5776
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5777
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5778
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5779
    (self respondsTo:evType) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5780
	arguments := evArray copyFrom:3 to:(3 + evType argumentCount - 1).
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5781
	arguments at:1 put:view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5782
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5783
	self perform:evType withArguments:arguments.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5784
	^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5785
    ].
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5786
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5787
    '********** unhandled event:' errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5788
    evType errorPrintCR. (evArray at:2) errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5789
    '********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5790
    ^ false
7959
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5791
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5792
    "Modified: / 23-02-2017 / 19:57:57 / mawalch"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5793
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5794
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5795
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5796
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5797
     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
  5798
     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
  5799
     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
  5800
     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
  5801
     handled.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5802
     WARNING: this may block to wait for an event - you better check for a
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5803
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5804
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5805
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5806
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5807
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5808
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5809
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5810
	AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5811
	    ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5812
	] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5813
	    self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5814
	]
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5815
    ].
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5816
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5817
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5818
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5819
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5820
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5821
    "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
  5822
     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
  5823
     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
  5824
     WARNING: this may block to wait for an event - you better check for a
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5825
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5826
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5827
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5828
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5829
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5830
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5831
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5832
dispatchLoop
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5833
    preWaitAction := [self flush].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5834
    Processor addPreWaitAction:preWaitAction.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5835
    [
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5836
	super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  5837
    ] ensure:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5838
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5839
	preWaitAction := nil.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5840
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5841
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5842
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5843
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5844
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5845
     (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
  5846
     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
  5847
     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
  5848
     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
  5849
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5850
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5851
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5852
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5853
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5854
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5855
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5856
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5857
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5858
	    self dispatchExposeEventFor:dispatchingExpose
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5859
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5860
	^ self
6032
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  5861
    ].
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  5862
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5863
    [self eventPendingWithSync:false] whileTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5864
	eventArray isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5865
	    eventArray := Array new:13.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5866
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5867
	(self getEventFor:nil withMask:nil into:eventArray) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5868
	    AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5869
		ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5870
	    ] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5871
		self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5872
		"/ multi-screen config: give others a chance
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5873
		"/ (needed because we run at high (non-timesliced) prio)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5874
		Processor yield.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5875
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5876
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5877
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5878
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5879
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5880
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5881
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5882
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5883
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5884
     events matching the mask are thrown away regardless of which
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5885
     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
  5886
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5887
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5888
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  5889
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5890
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5891
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5892
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5893
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5894
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5895
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5896
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5897
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5898
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5899
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5900
	    win = __WindowVal(aWindowIdOrNil);
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  5901
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  5902
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5903
	} else {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  5904
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  5905
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5906
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5907
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5908
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5909
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5910
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5911
    self primitiveFailedOrClosedConnection
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
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5914
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5915
    "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
  5916
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5917
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5918
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5919
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5920
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5921
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5922
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5923
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5924
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5925
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5926
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5927
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5928
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5929
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5930
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5931
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5932
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5933
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5934
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5935
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5936
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5937
    else if (anEventSymbol == @symbol(substructureNotify)) m = SubstructureNotifyMask;
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5938
    else if (anEventSymbol == @symbol(substructureRedirect)) m = SubstructureRedirectMask;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5939
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5940
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5941
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5942
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5943
eventPending
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5944
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5945
     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
  5946
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5947
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5948
    "/ 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
  5949
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5950
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5951
    dispatchingExpose notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  5952
	^ self exposeEventPendingFor:dispatchingExpose withSync:ConservativeSync
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  5953
    ].
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  5954
    ^ self eventPendingWithSync:ConservativeSync
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5955
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5956
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5957
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5958
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5959
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5960
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5961
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5962
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5963
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5964
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5965
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5966
    "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
  5967
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5968
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5969
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5970
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5971
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5972
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5973
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5974
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5975
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5976
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5977
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5978
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5979
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5980
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5981
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5982
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5983
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5984
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5985
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5986
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5987
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5988
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5989
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5990
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5991
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5992
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5993
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5994
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5995
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5996
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5997
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5998
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5999
eventPendingWithSync:doSync
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6000
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6001
     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
  6002
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6003
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6004
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6005
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6006
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6007
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6008
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6009
	Display *dpy = myDpy;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6010
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6011
	if (XEventsQueued(dpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6012
	    RETURN (true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6013
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6014
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6015
	ENTER_XLIB();
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6016
	if (doSync == true) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6017
	    XSync(dpy, 0);      /* make certain everything is flushed */
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6018
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6019
	if (XEventsQueued(dpy, QueuedAfterFlush)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6020
	    rslt = true;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6021
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6022
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6023
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6024
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6025
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6026
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6027
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6028
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6029
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6030
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6031
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6032
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6033
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6034
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6035
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6036
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6037
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6038
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6039
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6040
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6041
     (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
  6042
      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
  6043
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6044
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6045
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6046
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6047
	if (XEventsQueued(myDpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6048
	    RETURN(true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6049
	}
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6050
    }
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6051
    RETURN ( false );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6052
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6053
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6054
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6055
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6056
    "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
  6057
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6058
     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
  6059
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6060
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6061
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6062
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6063
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6064
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6065
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6066
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6067
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6068
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6069
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6070
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6071
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6072
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6073
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6074
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6075
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6076
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6077
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6078
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6079
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6080
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6081
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6082
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6083
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6084
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6085
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6086
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6087
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6088
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6089
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6090
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6091
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6092
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6093
    "read next event if there is one and put event's data into anEventArray.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6094
     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
  6095
     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
  6096
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6097
     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
  6098
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6099
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6100
     The event fields are placed into anEventArray (must be at least size 13):
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6101
     the fields are:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6102
	1:      windowID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6103
	2:      eventType-ID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6104
	3:      eventTypeSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6105
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6106
	4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6107
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  6108
     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
  6109
     handler method to allow UNLIMITEDSTACK here.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6110
     (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
  6111
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6112
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6113
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6114
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6115
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6116
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6117
    Window win, wWanted;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6118
    int evMask, returnValue;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6119
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6120
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6121
    KeySym keySym;
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6122
    unsigned char buffer[64];
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6123
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6124
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6125
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6126
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6127
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6128
	RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6129
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6130
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6131
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6132
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6133
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6134
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6135
    if (__isSmallInteger(eventMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6136
	evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6137
    } else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6138
	evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6139
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6140
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6141
    if (__isExternalAddress(aViewIdOrNil)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6142
	wWanted = __WindowVal(aViewIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6143
	returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6144
    } else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6145
	if (evMask == ~0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6146
	    XNextEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6147
	    returnValue = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6148
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6149
	    returnValue = XCheckMaskEvent(dpy, evMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6150
	}
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6151
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6152
    if (!returnValue) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6153
	/* there is no event */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6154
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6155
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6156
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6157
    if (anEventArray == nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6158
	/* sender is not interested in the event */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6159
	RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6160
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6161
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6162
    if (!__isArray(anEventArray)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6163
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6164
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6165
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6166
    if (__arraySize(anEventArray) < 11) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6167
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6168
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6169
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6170
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6171
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6172
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6173
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6174
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6175
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6176
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6177
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6178
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6179
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6180
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6181
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6182
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6183
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6184
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6185
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6186
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6187
#   define rr ((XResizeRequestEvent *)&ev)
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6188
#   define rpe ((XReparentEvent *)&ev)
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6189
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6190
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6191
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6192
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6193
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6194
    if (((t = __INST(lastId)) != nil)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6195
	 && __isExternalAddress(t)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6196
	 && (__WindowVal(t) == ae->window)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6197
	windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6198
    } else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6199
	windowID = __MKEXTERNALADDRESS(ae->window);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6200
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6201
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6202
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6203
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6204
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6205
    switch (ev.type) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6206
	case KeyRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6207
	    sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6208
	    goto keyPressAndRelease;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6209
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6210
	case KeyPress:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6211
	    sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6212
	    /* FALL INTO */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6213
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6214
	keyPressAndRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6215
	    arg = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6216
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6217
	    if (nchars == 1 && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6218
		|| (buffer[0] >= 0x80))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6219
		arg = __MKCHARACTER(buffer[0]);
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6220
//            } else if (nchars > 2) {
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6221
//                arg = __MKSTRING_L(buffer, nchars);
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6222
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6223
		keySymString = XKeysymToString(keySym);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6224
		if (keySymString) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6225
		    arg = __MKSYMBOL(keySymString, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6226
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6227
	    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6228
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6229
#ifdef IGNORE_UNKNOWN_KEYCODES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6230
	    if (arg == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6231
		/* happens sometimes (alt-graph on sun has no keysym) */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6232
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6233
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6234
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6235
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6236
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6237
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6238
	    t = __MKUINT(ke->keycode); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6239
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6240
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6241
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6242
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6243
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6244
	    t = __MKUINT(ke->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6245
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6246
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6247
	case ButtonPress:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6248
	    sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6249
	    goto buttonPressAndRelease;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6250
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6251
	case ButtonRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6252
	    sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6253
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6254
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6255
	buttonPressAndRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6256
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6257
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6258
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6259
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6260
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6261
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6262
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6263
	    t = __MKUINT(be->time); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6264
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6265
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6266
	case MotionNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6267
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6268
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6269
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6270
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6271
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6272
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6273
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6274
	    t = __MKUINT(me->time); __ArrayInstPtr(anEventArray)->a_element[8] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6275
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6276
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6277
	case FocusIn:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6278
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6279
	    goto focusInOut;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6280
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6281
	case FocusOut:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6282
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6283
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6284
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6285
	focusInOut:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6286
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6287
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6288
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6289
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6290
	case EnterNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6291
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6292
	    goto enterLeave;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6293
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6294
	case LeaveNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6295
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6296
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6297
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6298
	enterLeave:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6299
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6300
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6301
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6302
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6303
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6304
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6305
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6306
	    t = __MKUINT(ele->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6307
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6308
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6309
	case Expose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6310
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6311
	    goto expose;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6312
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6313
	case GraphicsExpose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6314
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6315
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6316
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6317
	expose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6318
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6319
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6320
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6321
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6322
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6323
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6324
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6325
	case NoExpose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6326
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6327
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6328
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6329
	case VisibilityNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6330
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6331
	    switch (ve->state) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6332
		case VisibilityUnobscured:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6333
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6334
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6335
		case VisibilityPartiallyObscured:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6336
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6337
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6338
		case VisibilityFullyObscured:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6339
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6340
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6341
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6342
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6343
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6344
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6345
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6346
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6347
	case CreateNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6348
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6349
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6350
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6351
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6352
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6353
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6354
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6355
	case DestroyNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6356
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6357
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6358
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6359
	case UnmapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6360
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6361
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6362
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6363
	case MapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6364
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6365
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6366
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6367
	case ConfigureNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6368
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:relativeTo:x:y:width:height:borderWidth:above:overrideRedirect:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6369
	    __ArrayInstPtr(anEventArray)->a_element[3] = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6370
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6371
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6372
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6373
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ce->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6374
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ce->border_width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6375
	   __ArrayInstPtr(anEventArray)->a_element[9] = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6376
	    __ArrayInstPtr(anEventArray)->a_element[10] = ce->override_redirect ? true : false;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6377
	    if (ce->event != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6378
		t = __MKEXTERNALADDRESS(ce->event); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6379
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6380
	    if (ce->above != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6381
		t = __MKEXTERNALADDRESS(ce->above); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6382
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6383
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6384
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6385
	case GravityNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6386
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6387
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6388
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6389
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6390
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6391
	case ResizeRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6392
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6393
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6394
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6395
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6396
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6397
	case ConfigureRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6398
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6399
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6400
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6401
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6402
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6403
	    __ArrayInstPtr(anEventArray)->a_element[7] = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6404
	    if (cr->above != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6405
		t = __MKEXTERNALADDRESS(cr->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6406
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6407
	    switch (cr->detail) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6408
		case Above:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6409
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6410
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6411
		case Below:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6412
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6413
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6414
		case TopIf:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6415
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6416
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6417
		case BottomIf:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6418
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6419
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6420
		case Opposite:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6421
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6422
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6423
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6424
		    __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6425
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6426
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6427
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6428
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6429
	case CirculateNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6430
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6431
	    goto circulate;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6432
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6433
	case CirculateRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6434
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6435
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6436
	circulate:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6437
	    switch (cie->place) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6438
		case PlaceOnTop:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6439
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6440
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6441
		case PlaceOnBottom:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6442
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6443
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6444
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6445
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6446
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6447
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6448
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6449
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6450
	case PropertyNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6451
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6452
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6453
	    switch (pe->state) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6454
		case PropertyNewValue:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6455
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6456
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6457
		case PropertyDelete:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6458
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6459
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6460
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6461
		    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6462
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6463
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6464
	    t = __MKUINT(pe->time); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6465
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6466
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6467
	case SelectionClear:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6468
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6469
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6470
	    t = __MKUINT(sce->time); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6471
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6472
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6473
	case SelectionRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6474
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6475
	     * someone wants the selection
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6476
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6477
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6478
	    t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6479
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6480
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6481
	    __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6482
	    t = __MKUINT(ev.xselectionrequest.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6483
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6484
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6485
	case SelectionNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6486
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6487
	     * returned selection value (answer from SelectionRequest)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6488
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6489
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6490
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6491
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6492
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6493
	    t = __MKEXTERNALADDRESS(ev.xselection.requestor); __ArrayInstPtr(anEventArray)->a_element[6] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6494
	    t = __MKUINT(ev.xselection.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6495
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6496
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6497
	case ColormapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6498
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6499
	    __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6500
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6501
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6502
	case ClientMessage:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6503
	    if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6504
		if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6505
		 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6506
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6507
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6508
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6509
		if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6510
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6511
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6512
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6513
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6514
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6515
	     * any other client message
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6516
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6517
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6518
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6519
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6520
	    t = __MKBYTEARRAY(&ev.xclient.data, sizeof(ev.xclient.data)); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6521
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6522
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6523
	case MappingNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6524
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6525
	    switch(mape->request) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6526
		case MappingModifier:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6527
		    arg = @symbol(mappingModifier);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6528
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6529
		case MappingKeyboard:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6530
		    arg = @symbol(mappingKeyboard);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6531
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6532
		case MappingPointer:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6533
		    arg = @symbol(mappingPointer);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6534
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6535
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6536
		    arg = __MKSMALLINT(mape->request);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6537
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6538
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6539
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6540
	    t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6541
	    __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6542
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6543
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6544
	case KeymapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6545
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6546
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6547
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6548
	case MapRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6549
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6550
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6551
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6552
	case ReparentNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6553
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6554
	    t = __MKEXTERNALADDRESS(rpe->parent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6555
	    __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6556
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6557
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6558
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6559
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6560
	default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6561
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6562
	    break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6563
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6564
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6565
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6566
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6567
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6568
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6569
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6570
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6571
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6572
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6573
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6574
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6575
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6576
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6577
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6578
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6579
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6580
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6581
#undef rr
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6582
#undef rpe
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6583
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  6584
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6585
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6586
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6587
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6588
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6589
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6590
    ^ true
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6591
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6592
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6593
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6594
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6595
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6596
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6597
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6598
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6599
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6600
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6601
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6602
    dispatchingExpose := aView id
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6603
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6604
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6605
registerHotKeyForWindow:aDrawableId withId:anId modifiers:aModifier virtualKeyCode:aVirtualKeyCode
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6606
    "Defines a system-wide hot key."
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6607
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6608
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6609
    "no-op until implemented"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6610
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6611
    ^ false.
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6612
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6613
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6614
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6615
    "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
  6616
     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
  6617
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6618
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6619
%{
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6620
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6621
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6622
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6623
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6624
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6625
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6626
	mask = __intVal(aMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6627
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6628
#ifdef OLD
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6629
	/* these may not be disabled */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6630
	mask |= ExposureMask | StructureNotifyMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6631
		KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6632
		EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6633
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6634
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6635
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6636
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6637
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6638
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6639
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6640
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6641
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6642
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6643
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6644
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6645
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6646
    "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
  6647
6252
35df59ca8863 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  6648
    (dispatchProcess notNil and:[dispatchProcess isDead not]) ifTrue:[^ self].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6649
    dispatchingExpose := nil.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  6650
    super startDispatch.
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6651
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6652
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6653
unregisterHotKeyForWindow:aDrawableId withId:anId
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6654
    "Release a system-wide hot key."
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6655
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6656
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6657
    "no-op until implemented. Since we never registered anything, the unregister succeeds"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6658
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6659
    ^ true.
6294
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6660
!
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6661
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6662
viewIsRelevantInCheckForEndOfDispatch:aView
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6663
    aView == windowGroupWindow ifTrue:[^ false].
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6664
    ^ super viewIsRelevantInCheckForEndOfDispatch:aView
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6665
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6666
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6667
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6668
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6669
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
  6670
    "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
  6671
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6672
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6673
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6674
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6675
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6676
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6677
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6678
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6679
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6680
    "/ Event.xclient.format            = msgFormat;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6681
    "/ Event.xclient.window            = windowID;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6682
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6683
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6684
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6685
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6686
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6687
    "/
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6688
    "/ XSendEvent(dpy, targetWindowID, propagate, eventMask, &Event);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6689
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6690
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6691
%{
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6692
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6693
    int state;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6694
    int __eventMask;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6695
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6696
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6697
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6698
     && __isInteger(msgFormat)
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6699
     && (eventMask == nil || __isInteger(eventMask))
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6700
     && (__isExternalAddress(windowID) || __isInteger(windowID))
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6701
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6702
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6703
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6704
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6705
	Window targetWindow;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6706
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6707
	if (__isInteger(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6708
	    ev.xclient.data.l[0] = __longIntVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6709
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6710
	    if (__isExternalAddress(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6711
		ev.xclient.data.l[0] = (INT)__externalAddressVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6712
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6713
		ev.xclient.data.l[0] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6714
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6715
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6716
	if (__isInteger(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6717
	    ev.xclient.data.l[1] = __longIntVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6718
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6719
	    if (__isExternalAddress(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6720
		ev.xclient.data.l[1] = (INT)__externalAddressVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6721
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6722
		ev.xclient.data.l[1] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6723
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6724
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6725
	if (__isInteger(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6726
	    ev.xclient.data.l[2] = __longIntVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6727
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6728
	    if (__isExternalAddress(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6729
		ev.xclient.data.l[2] = (INT)__externalAddressVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6730
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6731
		ev.xclient.data.l[2] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6732
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6733
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6734
	if (__isInteger(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6735
	    ev.xclient.data.l[3] = __longIntVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6736
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6737
	    if (__isExternalAddress(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6738
		ev.xclient.data.l[3] = (INT)__externalAddressVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6739
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6740
		ev.xclient.data.l[3] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6741
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6742
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6743
	if (__isInteger(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6744
	    ev.xclient.data.l[4] = __longIntVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6745
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6746
	    if (__isExternalAddress(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6747
		ev.xclient.data.l[4] = (INT)__externalAddressVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6748
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6749
		ev.xclient.data.l[4] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6750
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6751
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6752
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6753
	if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6754
	    ev.xclient.window = __WindowVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6755
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6756
	    ev.xclient.window = (Window)__longIntVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6757
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6758
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6759
	if (__isExternalAddress(targetWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6760
	    targetWindow = __WindowVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6761
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6762
	    targetWindow = (Window)__longIntVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6763
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6764
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6765
	ev.xclient.type              = ClientMessage;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6766
	ev.xclient.display           = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6767
	ev.xclient.message_type      = __longIntVal(msgType);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6768
	ev.xclient.format            = __longIntVal(msgFormat);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6769
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6770
	if (eventMask == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6771
	    __eventMask = NoEventMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6772
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6773
	    __eventMask = __longIntVal(eventMask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6774
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6775
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6776
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6777
	result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6778
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6779
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6780
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6781
	    DPRINTF(("bad status in sendClientEvent\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6782
	    RETURN ( false )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6783
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6784
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6785
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6786
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6787
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6788
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6789
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6790
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6791
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
  6792
    "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
  6793
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6794
     For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...);
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6795
     for key events, it can be either a symbol (as listed in X's keySyms)
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6796
     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
  6797
     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
  6798
     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
  6799
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6800
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6801
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6802
%{
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6803
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6804
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6805
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6806
    if (__isSmallInteger(stateMask)) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6807
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6808
    } else {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6809
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6810
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6811
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6812
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6813
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  6814
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr))
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6815
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6816
	Display *dpy = myDpy;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6817
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6818
	XEvent ev;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6819
	Window target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6820
	Status result;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6821
	KeySym keySym, *syms;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6822
	int screen = __intVal(__INST(screen));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6823
	int nSyms;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6824
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6825
	if ((typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6826
	 || (typeSymbol == @symbol(keyRelease))) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6827
	    if (__isStringLike(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6828
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6829
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6830
		if (__isCharacter(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6831
		    char s[2];
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6832
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6833
		    s[1] = '\0';
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6834
		    keySym = XStringToKeysym(s);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6835
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6836
		    if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6837
			keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6838
		    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6839
			goto notOk;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6840
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6841
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6842
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6843
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6844
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6845
	    if (stateMask == nil) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6846
		/*
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6847
		 * get the modifier from the keySym
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6848
		 */
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6849
		nSyms = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6850
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6851
		if (syms) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6852
		    int i;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6853
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6854
		    for (i=0; i<nSyms; i++) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6855
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6856
#ifdef MODIFIERDEBUG
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6857
			    console_printf("modifier-index is %d\n", i);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6858
#endif
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6859
			    if (i) state = (1 << (i-1));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6860
			    break;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6861
			}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6862
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6863
		    XFree(syms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6864
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6865
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6866
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6867
	    if ((typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6868
	     || (typeSymbol == @symbol(buttonRelease))) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6869
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6870
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6871
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6872
		    ev.xbutton.button = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6873
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6874
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6875
		DPRINTF(("invalid sendEvent typeSymbol\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6876
		RETURN (false);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6877
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6878
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6879
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6880
	if (typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6881
	    ev.xany.type = KeyPress;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6882
	else if (typeSymbol == @symbol(keyRelease))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6883
	    ev.xany.type = KeyRelease;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6884
	else if (typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6885
	    ev.xany.type = ButtonPress;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6886
	else if (typeSymbol == @symbol(buttonRelease))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6887
	    ev.xany.type = ButtonRelease;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6888
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6889
	if (__isExternalAddress(targetId)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6890
	    target = __WindowVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6891
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6892
	    target = (Window) __longIntVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6893
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6894
	ev.xkey.window = target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6895
	ev.xkey.same_screen = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6896
	ev.xkey.subwindow = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6897
	ev.xkey.root = RootWindow(dpy, screen);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6898
	ev.xkey.x = __intVal(xPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6899
	ev.xkey.y = __intVal(yPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6900
	ev.xkey.state = state;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6901
	ev.xkey.time = CurrentTime;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6902
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6903
	ENTER_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6904
	result = XSendEvent(dpy, target, False, 0 , &ev);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6905
	LEAVE_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6906
	if ((result == BadValue) || (result == BadWindow)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6907
	    DPRINTF(("bad status\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6908
	    RETURN ( false )
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6909
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6910
	RETURN (true)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6911
    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6912
  notOk: ;
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6913
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6914
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6915
    ^ false
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6916
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6917
    "<<END
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6918
     |v|
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6919
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6920
     v := EditTextView extent:200@100.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6921
     v contents:'Hello world'.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6922
     v openAndWait.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6923
     v selectFromCharacterPosition:1 to:5.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6924
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6925
     "/ CTRL-c
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6926
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6927
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6928
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6929
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6930
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6931
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6932
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6933
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6934
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6935
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6936
	 keyOrButton:'c'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6937
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6938
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6939
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6940
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6941
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6942
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6943
	 keyOrButton:'c'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6944
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6945
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6946
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6947
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6948
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6949
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6950
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6951
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6952
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6953
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6954
     "/ CTRL-v
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6955
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6956
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6957
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6958
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6959
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6960
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6961
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6962
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6963
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6964
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6965
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6966
	 keyOrButton:'v'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6967
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6968
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6969
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6970
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6971
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6972
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6973
	 keyOrButton:'v'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6974
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6975
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6976
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6977
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6978
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6979
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6980
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6981
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6982
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6983
END"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6984
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6985
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6986
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6987
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6988
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6989
    "a basic method for X-font allocation; this method allows
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  6990
     any font to be acquired (even those not conforming to
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6991
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6992
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6993
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6994
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  6995
%{  /* STACK: 100000 */
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  6996
    /*** UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6997
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6998
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6999
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  7000
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  7001
     && __isStringLike(aFontName)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7002
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7003
	ENTER_XLIB();
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7004
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7005
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  7006
#ifdef COUNT_RESOURCES
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7007
	if (newFont)
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7008
	    __cnt_font++;
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7009
#endif
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7010
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7011
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
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
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  7014
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7015
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7016
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7017
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7018
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7019
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7020
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7021
     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
  7022
      -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
  7023
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7024
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7025
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7026
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7027
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7028
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7029
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7030
    fields size == 3 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7031
	"take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7032
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7033
	style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7034
	size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7035
    ] ifFalse:[fields size == 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7036
	"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7037
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7038
	size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7039
    ] ifFalse:[fields size >= 15 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7040
	family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7041
	face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7042
	style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7043
	style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7044
	    style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7045
	] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7046
	     style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7047
	] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7048
	     style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7049
	]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7050
	moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7051
	(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7052
	    style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7053
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7054
	fheight := fields at:8.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7055
	size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7056
	resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7057
	resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7058
	registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7059
	encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7060
	coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7061
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7062
	^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7063
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7064
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7065
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7066
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7067
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7068
encodingOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7069
    "the font's encoding - if the font does not provide that info,
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7070
     return nil (and assume #ascii, which is a subset of #iso8859-1)."
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7071
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7072
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7073
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7074
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7075
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7076
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7077
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7078
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7079
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7080
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7081
    coll notNil ifTrue:[ coll := self atomName:coll].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7082
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7083
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7084
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7085
     "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7086
       Screen current encodingOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7087
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7088
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7089
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7090
extentsOf:aString from:index1 to:index2 inFont:aFontId into:anArray
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7091
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7092
    <context: #return>
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7093
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7094
%{  /* UNLIMITEDSTACK */
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7095
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7096
    XFontStruct *f;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7097
    char *cp;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7098
    int len, n, i1, i2, l;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7099
#   define NLOCALBUFFER 200
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7100
    XChar2b xlatebuffer[NLOCALBUFFER];
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7101
    int nInstBytes;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7102
    int directionReturn, fontAscentReturn, fontDescentReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7103
    XCharStruct overAllReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7104
    OBJ *resultArray;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7105
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7106
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7107
	 && __bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7108
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7109
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7110
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7111
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7112
	if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7113
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7114
	if (__isArray(anArray) && __arraySize(anArray) > 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7115
	    resultArray = __arrayVal(anArray);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7116
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7117
	    resultArray = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7118
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7119
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7120
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7121
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7122
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7123
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7124
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7125
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7126
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7127
		RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7128
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7129
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7130
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7131
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7132
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7133
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7134
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7135
		if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7136
		cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7137
		len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7138
					&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7139
					&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7140
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7141
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7142
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7143
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7144
		n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7145
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7146
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7147
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7148
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7149
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7150
		    len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7151
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7152
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7153
		} else  if (__isWords(aString)) { /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7154
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7155
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7156
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7157
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7158
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7159
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7160
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7161
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7162
		    n = n / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7163
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7164
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7165
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7166
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7167
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7168
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7169
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7170
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7171
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7172
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7173
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7174
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7175
		    if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7176
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7177
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7178
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7179
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7180
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7181
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7182
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7183
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7184
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7185
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7186
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7187
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7188
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7189
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7190
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7191
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7192
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7193
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7194
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7195
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7196
		} else if (__isLongs(aString)) { /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7197
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7198
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7199
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7200
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7201
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7202
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7203
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7204
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7205
		    n = n / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7206
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7207
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7208
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7209
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7210
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7211
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7212
		     * For now: X does not support 32bit characters without the new 32Unicode extensions.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7213
		     * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7214
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7215
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7216
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7217
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7218
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7219
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7220
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7221
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7222
			int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7223
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7224
			codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7225
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7226
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7227
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7228
			cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7229
			cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7230
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7231
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7232
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7233
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7234
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7235
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7236
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7237
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7238
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7239
		} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7240
		    goto fail;      /*unknown string class */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7241
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7242
	    if (resultArray) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7243
		switch (__arraySize(anArray)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7244
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7245
		case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7246
		    resultArray[7] = __MKSMALLINT(directionReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7247
		case 7:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7248
		    resultArray[6] = __MKSMALLINT(fontDescentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7249
		case 6:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7250
		    resultArray[5] = __MKSMALLINT(fontAscentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7251
		case 5:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7252
		    resultArray[4] = __MKSMALLINT(overAllReturn.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7253
		case 4:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7254
		    resultArray[3] = __MKSMALLINT(overAllReturn.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7255
		case 3:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7256
		    resultArray[2] = __MKSMALLINT(overAllReturn.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7257
		case 2:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7258
		    resultArray[1] = __MKSMALLINT(overAllReturn.rbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7259
		case 1:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7260
		    resultArray[0] = __MKSMALLINT(overAllReturn.lbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7261
		case 0:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7262
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7263
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7264
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7265
	    RETURN ( __MKSMALLINT(overAllReturn.width) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7266
	}
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7267
    }
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7268
#undef NLOCALBUFFER
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7269
fail: ;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7270
%}.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7271
    self primitiveFailedOrClosedConnection.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7272
    ^ 0
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7273
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7274
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7275
      |result|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7276
      result := Array new:8.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7277
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7278
	extentsOf:'hello World' from:1 to:11
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7279
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7280
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7281
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7282
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7283
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7284
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7285
		    size:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7286
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7287
	    )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7288
	into:result.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7289
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7290
      result
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7291
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7292
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7293
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7294
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
  7295
    "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
  7296
     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
  7297
     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
  7298
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7299
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7300
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7301
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7302
    (registry size ~~ 0) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7303
	enc := registry asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7304
	encoding size ~~ 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7305
	   enc := enc, '-', encoding asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7306
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7307
	enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7308
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7309
	(encoding size ~~ 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7310
	    enc := encoding asLowercase asSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7311
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7312
	    charSets := charSetCollections.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7313
	    (charSets notEmptyOrNil) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7314
		charSets := charSets asUppercase asCollectionOfWords.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7315
		(charSets includes:'ISO8859-1') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7316
		    enc := #'iso8859-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7317
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7318
		    (charSets includes:'ISO8859') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7319
			enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7320
		    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7321
			(charSets includes:'ASCII') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7322
			    enc := #ascii
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7323
			] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7324
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7325
				enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7326
			    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7327
			]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7328
		    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7329
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7330
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7331
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7332
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7333
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7334
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7335
    "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
  7336
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7337
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7338
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7339
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7340
    "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
  7341
     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
  7342
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7343
    listOfXFonts := nil.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7344
    XftFontDescription notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7345
	XftFontDescription flushListOfAvailableFonts.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7346
    ].
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7347
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7348
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7349
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7350
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7351
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7352
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7353
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7354
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7355
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7356
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7357
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7358
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7359
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7360
     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
  7361
      -brand-family-face-style-moreStyle- -pxlSize-size-resX-resY-??-??-registry-encoding;
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7362
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7363
6010
6d7184a6456b cast to correct types
Stefan Vogel <sv@exept.de>
parents: 6009
diff changeset
  7364
    |family face style moreStyle size
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7365
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7366
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7367
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7368
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7369
    Error handle:[:ex |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7370
	family := nil.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7371
    ] do:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7372
	fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7373
	fields size == 3 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7374
	    "take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7375
	    family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7376
	    style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7377
	    size := Number readFromString:(fields at:3).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7378
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7379
	    fields size == 2 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7380
		"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7381
		family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7382
		size := Number readFromString:(fields at:2).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7383
	    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7384
		fields size >= 15 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7385
		    family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7386
		    face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7387
		    style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7388
		    style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7389
			style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7390
		    ] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7391
			 style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7392
		    ] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7393
			 style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7394
		    ]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7395
		    moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7396
		    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7397
			style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7398
		    ].
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7399
"/                    pxlSize := (Integer readFromString:(fields at:8)).
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7400
		    size := (Number readFromString:(fields at:9)) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7401
		    resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7402
		    resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7403
		    registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7404
		    encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7405
		    coding := registry , '-' , encoding.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7406
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7407
		    "/ very old name (such as cursor, 5x7 etc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7408
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7409
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7410
	].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7411
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7412
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7413
    family notNil ifTrue:[
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7414
       ^ 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
  7415
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7416
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7417
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7418
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7419
     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
  7420
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7421
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7422
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7423
fontMetricsOf:fontId
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7424
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7425
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7426
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7427
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7428
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7429
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7430
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7431
%{  /* UNLIMITEDSTACK */
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7432
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7433
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7434
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7435
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7436
	if (__isExternalAddress(fontId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7437
	    f = __FontVal(fontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7438
	    if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7439
		minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7440
		maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7441
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7442
		if (f->direction == FontLeftToRight) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7443
		    dir = @symbol(LeftToRight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7444
		} else if (f->direction == FontRightToLeft) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7445
		    dir = @symbol(RightToLeft);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7446
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7447
		avgAscent = __MKSMALLINT(f->ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7448
		avgDescent = __MKSMALLINT(f->descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7449
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7450
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7451
		minWidth = __MKSMALLINT(f->min_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7452
		maxWidth = __MKSMALLINT(f->max_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7453
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7454
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7455
		len = XTextWidth(f, "n", 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7456
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7457
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7458
		avgWidth = __MKSMALLINT( len );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7459
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7460
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7461
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7462
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7463
    avgAscent == nil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7464
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7465
	^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7466
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7467
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7468
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7469
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7470
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7471
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7472
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7473
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7474
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7475
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7476
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7477
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7478
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7479
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7480
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7481
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7482
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7483
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7484
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7485
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7486
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7487
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7488
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7489
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7490
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7491
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7492
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7493
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7494
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7495
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7496
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7497
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7498
     PropertyNames is an array with property names (symbols or strings).
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  7499
     Nonexistent properties are returned as nil"
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7500
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7501
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7502
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7503
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7504
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7505
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7506
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7507
     Screen current
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7508
	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistent)
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7509
	of:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7510
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7511
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7512
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7513
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7514
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7515
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7516
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7517
     Even indices contain the property value (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7518
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7519
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7520
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7521
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7522
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7523
%{
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7524
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7525
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7526
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7527
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7528
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7529
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7530
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7531
	if (f && (prop = f->properties) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7532
	    n = f->n_properties;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7533
	    propsArray = __ARRAY_NEW_INT(n*2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7534
	    for (i = 0; n; n--, prop++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7535
		x = __MKUINT(prop->name); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7536
		x = __MKUINT(prop->card32); __ArrayInstPtr(propsArray)->a_element[i++] = x; __STORE(propsArray, x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7537
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7538
	}
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7539
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7540
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7541
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7542
    propsArray notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7543
	propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7544
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7545
    ^ result
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7546
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7547
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7548
     Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7549
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1'))
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7550
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7551
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7552
     d := Dictionary new.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7553
     (Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')) keysAndValuesDo:[:name :value|
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7554
	  d at:name put:((Screen current atomName:value) ? value)
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7555
     ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7556
     d
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7557
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7558
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7559
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7560
fontResolutionOf:fontId
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7561
    "return the resolution (as dpiX @ dpiY) of the font - this is usually the display's resolution,
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7562
     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
  7563
     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
  7564
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7565
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7566
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7567
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7568
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7569
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  7570
    (resX notNil and:[resY notNil]) ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  7571
	^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7572
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7573
    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
  7574
    res notNil ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  7575
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7576
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7577
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7578
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7579
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7580
      Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7581
    "
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7582
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7583
    "Modified (comment): / 01-09-2017 / 09:58:19 / cg"
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7584
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7585
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  7586
fullFontNameOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7587
    "the font's fullName - this is very device specific and should only be
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7588
     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
  7589
     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
  7590
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7591
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  7592
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7593
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7594
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7595
	|fullNameID|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7596
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7597
	fullNameID := props at:try ifAbsent:nil.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7598
	fullNameID notNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7599
	    fullName := self atomName:fullNameID.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7600
	    fullName notEmptyOrNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7601
		^ fullName
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7602
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7603
	]
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7604
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7605
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7606
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7607
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7608
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7609
     Screen current fullFontNameOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7610
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7611
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7612
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7613
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7614
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7615
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7616
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7617
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7618
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7619
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7620
    int nnames = 30000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7621
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7622
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7623
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7624
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7625
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7626
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7627
	if (__isStringLike(pattern)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7628
	    for (;;) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7629
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7630
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7631
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7632
		if (fonts == 0) RETURN(nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7633
		if (available < nnames) break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7634
		XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7635
		nnames = available * 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7636
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7637
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7638
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7639
	     * now, that we know the number of font names,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7640
	     * create the array ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7641
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7642
	    arr = __ARRAY_NEW_INT(available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7643
	    if (arr != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7644
		/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7645
		 * ... and fill it
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7646
		 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7647
		for (i=0; i<available; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7648
		    __PROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7649
		    str = __MKSTRING(fonts[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7650
		    __UNPROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7651
		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7652
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7653
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7654
	    XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7655
	    RETURN (arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7656
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7657
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7658
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7659
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7660
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7661
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7662
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7663
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7664
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7665
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7666
getDefaultFontWithEncoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7667
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7668
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7669
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7670
    |id|
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7671
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7672
    id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding.
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7673
    id isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7674
	id := self createFontFor:'fixed'
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7675
    ].
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7676
    ^ id.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7677
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7678
     "
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7679
       Screen current getDefaultFontWithEncoding:#'iso10646-1'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7680
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7681
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7682
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7683
getFontWithFamily:familyString face:faceString
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7684
	    style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7685
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7686
    "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
  7687
     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
  7688
     as family and the other parameters as nil. For example, the cursor font
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  7689
     can be acquired that way."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7690
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7691
    |styleString theName theId xlatedStyle
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7692
     id spacing encodingMatch idx roundedSize pixelSize pointSize|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7693
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7694
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7695
5176
0c9f21d81a71 preps for pixel-sized fonts
Claus Gittinger <cg@exept.de>
parents: 5071
diff changeset
  7696
    sizeArgOrNil notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7697
	roundedSize := sizeArgOrNil rounded asInteger.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7698
	sizeUnit == #px ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7699
	    pixelSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7700
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7701
	    pointSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7702
	].
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  7703
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  7704
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7705
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7706
    faceString isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7707
	roundedSize notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7708
	    theName := familyString , '-' , roundedSize printString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7709
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7710
	    theName := familyString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7711
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7712
	theName notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7713
	    theId := self createFontFor:theName.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7714
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7715
	theId isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7716
	    theId := self getDefaultFontWithEncoding:encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7717
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7718
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7719
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7720
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7721
    "/ 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
  7722
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7723
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  7724
    (styleString notNil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7725
     and:[(styleString endsWith:'-narrow')
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7726
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7727
	|i|
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7728
	i := styleString lastIndexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7729
	spacing := styleString copyFrom:(i+1).
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7730
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7731
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7732
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7733
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7734
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7735
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7736
    xlatedStyle notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7737
	xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  7738
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  7739
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7740
    encoding isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7741
	encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7742
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7743
	idx := encoding indexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7744
	idx ~~ 0 ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7745
	    encodingMatch := encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7746
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7747
	    encodingMatch := encoding , '-*'.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7748
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7749
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7750
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7751
    id := self
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7752
	    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7753
	    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7754
	    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7755
	    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7756
	    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7757
	    pixelSize:pixelSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7758
	    size:pointSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7759
	    encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7760
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7761
    id isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7762
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7763
	    "/ too stupid: registries come in both cases
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7764
	    "/ and X does not ignore case
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7765
	    "/
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7766
	    id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7767
		    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7768
		    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7769
		    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7770
		    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7771
		    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7772
		    pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7773
		    size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7774
		    encoding:encodingMatch asUppercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7775
	    id isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7776
		id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7777
			getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7778
			family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7779
			weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7780
			slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7781
			spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7782
			pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7783
			size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7784
			encoding:encodingMatch asLowercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7785
	    ]
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7786
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7787
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7788
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7789
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7790
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7791
    "Modified: 10.4.1997 / 19:20:06 / cg"
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7794
getFontWithFoundry:foundry family:family weight:weight
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7795
	      slant:slant spacing:spc pixelSize:pSize size:size
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7796
	      encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7797
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7798
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7799
     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
  7800
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7801
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7802
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7803
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7804
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7805
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7806
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7807
     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
  7808
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7809
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7810
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7811
    |theName sizeMatch
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7812
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  7813
     pSizeMatch encodingMatch|
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
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7816
    "name is:
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7817
	-foundry-family    -weight -slant-
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7818
	 sony    helvetica bold     r
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7819
	 adobe   courier   medium   i
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7820
	 msic    fixed              o
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7821
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7822
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7823
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7824
    size isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7825
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7826
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7827
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7828
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7829
    foundry isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7830
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7831
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7832
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7833
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7834
    family isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7835
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7836
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7837
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7838
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7839
    weight isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7840
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7841
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7842
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7843
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7844
    slant isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7845
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7846
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7847
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7848
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7849
    spc isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7850
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7851
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7852
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7853
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7854
    pSize isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7855
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7856
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7857
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7858
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7859
    encoding isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7860
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7861
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7862
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7863
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7864
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7865
    theName := ('-' , foundryMatch,
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7866
		'-' , familyMatch,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7867
		'-' , weightMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7868
		'-' , slantMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7869
		'-' , spcMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7870
		'-*' ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7871
		'-' , pSizeMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7872
		'-' , sizeMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7873
		'-*-*-*-*' ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7874
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7875
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  7876
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7877
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7878
    ^ self createFontFor:theName.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7879
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7880
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7881
    "
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7882
     Display
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7883
	getFontWithFoundry:'*'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7884
	family:'courier'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7885
	weight:'medium'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7886
	slant:'r'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7887
	spacing:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7888
	pixelSize:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7889
	size:13
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7890
	encoding:#'iso8859-1'.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7891
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7892
     Display
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7893
	getFontWithFoundry:'*'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7894
	family:'courier'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7895
	weight:'medium'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7896
	slant:'r'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7897
	spacing:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7898
	pixelSize:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7899
	size:13
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7900
	encoding:#'iso10646-1'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7901
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7902
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7903
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7904
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7905
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7906
heightOf:aString from:index1 to:index2 inFont:aFontId
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7907
    |resultArray|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7908
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7909
    resultArray := Array new:5.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7910
    self extentsOf:aString from:index1 to:index2 inFont:aFontId into:resultArray.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7911
    ^ (resultArray at:4) + (resultArray at:5).
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7912
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7913
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7914
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7915
	heightOf:'hello world' from:1 to:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7916
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7917
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7918
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7919
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7920
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7921
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7922
		    size:13
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7923
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7924
	    ).
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7925
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7926
      Screen current
8053
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
  7927
	heightOf:'hello World gggÖÜ' from:1 to:15
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7928
	inFont:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7929
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7930
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7931
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7932
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7933
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7934
     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
  7935
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7936
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7937
6630
81c3e5842617 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6571
diff changeset
  7938
    |names listOfXftFonts|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7939
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7940
    listOfXFonts isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7941
	names := self getAvailableFontsMatching:'*'.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7942
	names isNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7943
	    "no names returned ..."
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7944
	    ^ nil
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7945
	].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7946
	listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7947
	listOfXFonts := FontDescription genericFonts, listOfXFonts.
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7948
    ].
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7949
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7950
    self supportsXftFonts ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7951
	UserPreferences current useXFontsOnly ifFalse:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7952
	    listOfXftFonts := XftFontDescription listOfAvailableFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7953
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7954
	    UserPreferences current useXftFontsOnly ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7955
		^ listOfXftFonts
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7956
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7957
	    ^ listOfXftFonts , listOfXFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7958
	].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7959
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7960
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7961
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7962
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7963
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7964
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7965
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7966
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7967
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7968
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7969
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7970
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7971
    "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
  7972
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7973
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7974
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7975
pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7976
    "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
  7977
     on this display.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7978
     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
  7979
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7980
    |sizes|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7981
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7982
    sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7983
    (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7984
	"special: in X11R5 and above, size 0 means:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7985
	 there are scaled versions in all sizes available"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7986
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7987
	^ #(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
  7988
    ].
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7989
    ^ sizes
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7990
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7991
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  7992
     Display pixelSizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7993
    "
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7994
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7995
    "Created: 27.2.1996 / 01:38:15 / cg"
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7996
!
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7997
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7998
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7999
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8000
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8001
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8002
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8003
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  8004
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  8005
     * 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
  8006
     */
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8007
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8008
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8009
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8010
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8011
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8012
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8013
	if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8014
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8015
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8016
	    XFreeFont(myDpy, f);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8017
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  8018
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8019
	    __cnt_font--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8020
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8021
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8022
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8023
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8024
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8025
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8026
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8027
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8028
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8029
    "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
  8030
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8031
     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
  8032
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8033
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8034
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8035
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8036
    (sizes notNil and:[sizes includes:0]) ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8037
	"special: in X11R5 and above, size 0 means:
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8038
	 there are scaled versions in all sizes available"
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8039
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8040
	^ #(4 5 6 7 8 9 10 11 12 13 14 15 16 17 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
  8041
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8042
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8043
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8044
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  8045
     Display sizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8046
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8047
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8048
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8049
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8050
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8051
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8052
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8053
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8054
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8055
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8056
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8057
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8058
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8059
    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
  8060
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8061
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  8062
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8063
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8064
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8065
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8066
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8067
	if (__bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8068
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8069
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8070
	    int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8071
	    f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8072
	    if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8073
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8074
	    i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8075
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8076
	    if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8077
		OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8078
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8079
		i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8080
		if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8081
		    RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8082
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8083
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8084
		cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8085
		l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8086
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8087
		if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8088
		    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8089
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8090
			cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8091
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8092
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8093
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8094
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8095
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8096
			//console_printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8097
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8098
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8099
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8100
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8101
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8102
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8103
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8104
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8105
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8106
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8107
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8108
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8109
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8110
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8111
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8112
		    n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8113
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8114
			cp += i1;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8115
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8116
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8117
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8118
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8119
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8120
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8121
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8122
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8123
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8124
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8125
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8126
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8127
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8128
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8129
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8130
		/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8131
		if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8132
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8133
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8134
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8135
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8136
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8137
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8138
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8139
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8140
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8141
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8142
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8143
			cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8144
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8145
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8146
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8147
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8148
			 * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8149
			 * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8150
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8151
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8152
			u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8153
			if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8154
			    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8155
				cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8156
			    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8157
				cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8158
				mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8159
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8160
			    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8161
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8162
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8163
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8164
			    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8165
			}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8166
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8167
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8168
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8169
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8170
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8171
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8172
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8173
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8174
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8175
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8176
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8177
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8178
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8179
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8180
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8181
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8182
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8183
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8184
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8185
		/* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8186
		if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8187
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8188
		    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8189
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8190
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8191
		    n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8192
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8193
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8194
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8195
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8196
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8197
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8198
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8199
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8200
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8201
			cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8202
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8203
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8204
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8205
			 * For now: X does not support 32bit characters without the new 32Unicode extensions.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8206
			 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8207
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8208
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8209
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8210
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8211
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8212
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8213
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8214
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8215
			    int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8216
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8217
			    codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8218
			    if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8219
				codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8220
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8221
			    cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8222
			    cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8223
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8224
			cp = (char *) cp2;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8225
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8226
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8227
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8228
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8229
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8230
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8231
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8232
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8233
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8234
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8235
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8236
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8237
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8238
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8239
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8240
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8241
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8242
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8243
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8244
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8245
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8246
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8247
#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
  8248
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8249
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8250
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  8251
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8252
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8253
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  8254
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8255
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8256
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8257
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8258
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8259
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8260
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8261
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8262
    if (mode == @symbol(asyncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8263
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8264
    else if (mode == @symbol(syncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8265
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8266
    else if (mode == @symbol(asyncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8267
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8268
    else if (mode == @symbol(syncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8269
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8270
    else if (mode == @symbol(syncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8271
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8272
    else if (mode == @symbol(asyncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8273
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8274
    else if (mode == @symbol(replayPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8275
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8276
    else if (mode == @symbol(replayKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8277
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8278
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8279
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8280
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8281
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8282
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8283
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8284
	XAllowEvents(myDpy, _mode, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8285
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8286
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8287
	RETURN (self);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8288
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8289
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8290
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8291
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8292
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8293
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8294
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8295
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8296
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8297
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8298
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8299
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8300
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8301
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8302
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8303
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8304
	    result = XGrabKeyboard(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8305
				   __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8306
				   True /* False */,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8307
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8308
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8309
				   CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8310
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8311
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8312
	    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8313
	    switch(result) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8314
		case AlreadyGrabbed:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8315
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8316
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8317
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8318
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8319
		case GrabNotViewable:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8320
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8321
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8322
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8323
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8324
		case GrabInvalidTime:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8325
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8326
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8327
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8328
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8329
		case GrabFrozen:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8330
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8331
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8332
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8333
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8334
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8335
		    ok = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8336
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8337
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8338
	    if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8339
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8340
		XUngrabKeyboard(myDpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8341
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8342
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8343
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8344
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8345
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8346
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8347
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8348
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8349
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8350
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8351
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8352
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8353
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
  8354
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8355
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8356
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8357
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8358
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8359
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8360
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8361
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8362
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8363
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8364
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8365
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8366
	    if (__isExternalAddress(confineId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8367
		confineWin = __WindowVal(confineId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8368
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8369
		confineWin = (Window) None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8370
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8371
	    if (__isExternalAddress(aCursorId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8372
		curs = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8373
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8374
		curs = (Cursor) None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8375
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8376
	    if (pMode == @symbol(sync))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8377
		pointer_mode = GrabModeSync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8378
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8379
		pointer_mode = GrabModeAsync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8380
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8381
	    if (kMode == @symbol(sync))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8382
		keyboard_mode = GrabModeSync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8383
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8384
		keyboard_mode = GrabModeAsync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8385
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8386
	    if (__isSmallInteger(eventMask))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8387
		evMask = __intVal(eventMask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8388
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8389
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8390
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8391
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8392
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8393
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8394
*/
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8395
	    result = XGrabPointer(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8396
				  __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8397
				  False,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8398
				  evMask,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8399
				  pointer_mode, keyboard_mode,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8400
				  confineWin,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8401
				  curs,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8402
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8403
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8404
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8405
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8406
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8407
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8408
	    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8409
	    switch (result) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8410
		case AlreadyGrabbed:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8411
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8412
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8413
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8414
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8415
		case GrabNotViewable:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8416
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8417
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8418
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8419
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8420
		case GrabInvalidTime:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8421
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8422
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8423
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8424
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8425
		case GrabFrozen:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8426
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8427
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8428
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8429
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8430
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8431
		    ok = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8432
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8433
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8434
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8435
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8436
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8437
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8438
*/
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8439
		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
  8440
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8441
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8442
*/
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8443
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8444
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8445
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8446
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8447
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8448
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8449
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8450
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8451
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8452
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8453
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
  8454
    "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
  8455
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8456
    ^ self
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8457
	grabPointerIn:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8458
	withCursor:aCursorId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8459
	eventMask:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8460
	pointerMode:pMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8461
	keyboardMode:kMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8462
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8463
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8464
    "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
  8465
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8466
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8467
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8468
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8469
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8470
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8471
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8472
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8473
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8474
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8475
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8476
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8477
	XUngrabKeyboard(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8478
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8479
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8480
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8481
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8482
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8483
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8484
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8485
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8486
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8487
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8488
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8489
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8490
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8491
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8492
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8493
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8494
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8495
	XUngrabPointer(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8496
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8497
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8498
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8499
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8500
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8501
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8502
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8503
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8504
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8505
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8506
    activeKeyboardGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8507
	activeKeyboardGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8508
	self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  8509
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8510
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8511
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8512
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8513
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8514
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8515
    activePointerGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8516
	activePointerGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8517
	self primUngrabPointer.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  8518
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8519
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8520
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8521
!XWorkstation methodsFor:'grabbing-keys'!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8522
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8523
grabKey:keySymCodeOrChar modifier:modifierMaskOrNil grabModeKeyboard:modeKbd grabModePointer:modePtr window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8524
    "internal basic entry to grab a single key either for an individual window
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8525
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8526
     The keySymCodeOrChar argument may be a keySym (name of a key) or an integer (the keySymCode)
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8527
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8528
     The modifierMaskOrNil is as mask as returned by altModifierMask, ctrlModifierMask, etc.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8529
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8530
     ModeKbd and modePtr are symbols GrabModeAsync or GrabModeSync.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8531
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8532
     After that, this key-event will no longer be sent to the window/screen.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8533
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8534
     Use with care: the only useful application is to define a special hotKey
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8535
     to start/stop event recorders without a need for a click or focus change.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8536
     Once grabbed, those key events will be exclusively reported to me.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8537
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8538
     Use GrabModeSync with big care - you can easily lock up your Xserver,
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8539
     and have to kill ST/X or force an ungrab from a remote login if you have.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8540
    "
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8541
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8542
%{
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8543
    int modifierMask = AnyModifier;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8544
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8545
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8546
    if (__isStringLike(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8547
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8548
    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8549
	if (__isCharacter(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8550
	    char s[2];
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8551
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8552
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8553
	    s[1] = '\0';
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8554
	    keySym = XStringToKeysym(s);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8555
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8556
	    if (__isSmallInteger(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8557
		keySym = (KeySym) __intVal(keySymCodeOrChar);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8558
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8559
		goto notOK;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8560
	    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8561
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8562
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8563
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8564
    if (modifierMaskOrNil != nil) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8565
	if (__isSmallInteger(modifierMaskOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8566
	    modifierMask = __intVal(modifierMaskOrNil);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8567
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8568
	    goto notOK;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8569
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8570
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8571
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8572
    if (ISCONNECTED) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8573
	Display *dpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8574
	Window window;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8575
	int keyCode;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8576
	int result;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8577
	int mKbd, mPtr;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8578
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8579
	mKbd = modeKbd == @symbol(GrabModeAsync) ? GrabModeAsync :GrabModeSync;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8580
	mPtr = modePtr == @symbol(GrabModeAsync) ? GrabModeAsync :GrabModeSync;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8581
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8582
	dpy = myDpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8583
	keyCode = XKeysymToKeycode(dpy, keySym);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8584
	if (__isExternalAddress(aWindowIdOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8585
	    window = __WindowVal(aWindowIdOrNil);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8586
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8587
	    int screen;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8588
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8589
	    screen = DefaultScreen(dpy);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8590
	    window = RootWindow(dpy, screen);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8591
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8592
	ENTER_XLIB();
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8593
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8594
	result = XGrabKey (dpy,
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8595
	    keyCode, modifierMask, window,
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8596
	    False, mKbd, mPtr );
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8597
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8598
	XSync(dpy, True);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8599
	XFlush(dpy);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8600
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8601
	LEAVE_XLIB();
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8602
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8603
	if (result != Success) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8604
	    if (result == BadAccess) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8605
		__INST(lastError) = @symbol(badAccess);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8606
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8607
		__INST(lastError) = @symbol(other);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8608
	    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8609
	    RETURN (false);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8610
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8611
	RETURN (true);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8612
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8613
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8614
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8615
    self primitiveFailedOrClosedConnection
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8616
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8617
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8618
grabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8619
    "grab a single key either for an individual window
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8620
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8621
     The keySymCodeOrChar argument may be a keySym (name of a key) or an integer (the keySymCode)
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8622
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8623
     The modifierMaskOrNil is as mask as returned by altModifierMask, ctrlModifierMask, etc.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8624
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8625
     Only the key is passed to myself - no permanent grab is installed.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8626
     (GrabModeAsync)"
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8627
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8628
    ^ self
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8629
	grabKey:keySymCodeOrChar
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8630
	modifier:modifierMaskOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8631
	grabModeKeyboard:#GrabModeAsync
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8632
	grabModePointer:#GrabModeAsync
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8633
	window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8634
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8635
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8636
ungrabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8637
    "ungrab a single key as previously grabbed via grabKey:
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8638
     Read the comment there."
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8639
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8640
%{
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8641
    int modifierMask = AnyModifier;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8642
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8643
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8644
    if (__isStringLike(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8645
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8646
    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8647
	if (__isCharacter(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8648
	    char s[2];
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8649
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8650
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8651
	    s[1] = '\0';
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8652
	    keySym = XStringToKeysym(s);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8653
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8654
	    if (__isSmallInteger(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8655
		keySym = (KeySym) __intVal(keySymCodeOrChar);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8656
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8657
		goto notOK;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8658
	    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8659
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8660
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8661
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8662
    if (modifierMaskOrNil != nil) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8663
	if (__isSmallInteger(modifierMaskOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8664
	    modifierMask = __intVal(modifierMaskOrNil);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8665
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8666
	    goto notOK;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8667
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8668
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8669
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8670
    if (ISCONNECTED) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8671
	Display *dpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8672
	Window window;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8673
	int keyCode;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8674
	int result;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8675
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8676
	dpy = myDpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8677
	if (__isExternalAddress(aWindowIdOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8678
	    window = __WindowVal(aWindowIdOrNil);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8679
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8680
	    int screen;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8681
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8682
	    screen = DefaultScreen(dpy);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8683
	    window = RootWindow(dpy, screen);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8684
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8685
	keyCode = XKeysymToKeycode(dpy, keySym);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8686
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8687
	ENTER_XLIB();
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8688
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8689
	result = XUngrabKey (dpy, keyCode, modifierMask, window);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8690
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8691
	XSync(dpy, True);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8692
	XFlush(dpy);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8693
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8694
	LEAVE_XLIB();
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8695
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8696
	if (result != Success) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8697
	    if (result == BadAccess) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8698
		__INST(lastError) = @symbol(badAccess);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8699
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8700
		__INST(lastError) = @symbol(other);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8701
	    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8702
	    RETURN (false);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8703
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8704
	RETURN (true);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8705
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8706
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8707
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8708
    self primitiveFailedOrClosedConnection
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8709
! !
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8710
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8711
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8712
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8713
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8714
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8715
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8716
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8717
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8718
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8719
    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
  8720
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8721
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8722
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8723
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8724
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8725
	    gcv.clip_mask = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8726
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8727
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8728
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8729
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8730
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8731
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8732
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8733
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8734
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8735
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8736
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8737
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8738
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8739
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8740
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8741
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8742
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8743
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8744
	 && __isSmallInteger(bgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8745
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8746
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8747
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8748
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8749
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8750
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8751
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8752
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8753
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8754
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8755
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8756
    "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
  8757
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8758
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8759
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8760
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8761
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8762
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8763
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8764
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8765
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8766
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8767
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8768
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8769
	    if (__isExternalAddress(aBitmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8770
		bitmap = __PixmapVal(aBitmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8771
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8772
		XSetStipple(dpy, gc, bitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8773
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8774
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8775
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8776
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8777
	    if (aBitmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8778
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8779
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8780
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8781
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8782
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8783
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8784
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8785
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8786
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8787
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8788
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  8789
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8790
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8791
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8792
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8793
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8794
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8795
    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
  8796
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8797
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8798
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8799
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8800
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8801
	    if (aBool == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8802
		gcv.subwindow_mode = ClipByChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8803
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8804
		gcv.subwindow_mode = IncludeInferiors;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8805
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8806
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8807
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8808
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8809
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8810
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8811
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8812
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8813
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8814
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8815
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8816
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
  8817
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8818
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8819
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8820
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8821
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8822
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8823
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8824
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8825
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8826
	 && __bothSmallInteger(clipX, clipY)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8827
	 && __bothSmallInteger(clipWidth, clipHeight)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8828
	    r.x = __intVal(clipX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8829
	    r.y = __intVal(clipY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8830
	    r.width = __intVal(clipWidth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8831
	    r.height = __intVal(clipHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8832
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8833
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8834
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8835
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8836
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8837
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8838
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8839
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8840
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8841
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8842
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8843
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8844
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8845
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8846
%{
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8847
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8848
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8849
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8850
	 && __isSmallInteger(offset)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8851
	 && __isByteArrayLike(dashList)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8852
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8853
	    XSetDashes(myDpy, __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8854
		       __intVal(offset),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8855
		       __ByteArrayInstPtr(dashList)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8856
		       __byteArraySize(dashList));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8857
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8858
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8859
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8860
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8861
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8862
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8863
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8864
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8865
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8866
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8867
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8868
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8869
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8870
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8871
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8872
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8873
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8874
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8875
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8876
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8877
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8878
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8879
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8880
	if (__isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8881
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8882
	    f = (XFontStruct *) __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8883
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8884
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8885
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8886
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8887
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8888
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8889
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8890
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8891
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8892
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8893
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8894
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8895
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8896
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8897
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8898
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8899
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8900
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8901
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8902
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8903
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8904
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8905
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8906
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8907
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8908
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8909
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8910
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8911
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8912
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8913
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8914
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8915
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8916
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8917
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8918
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8919
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8920
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8921
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8922
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8923
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8924
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8925
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8926
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8927
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8928
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8929
	 && __isSmallInteger(fgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8930
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8931
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8932
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8933
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8934
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8935
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8936
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8937
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8938
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8939
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8940
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8941
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8942
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8943
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8944
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8945
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8946
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8947
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8948
	if (__isExternalAddress(aGCId)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8949
	    GC gc = __GCVal(aGCId);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8950
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8951
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8952
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8953
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8954
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8955
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8956
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8957
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8958
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8959
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8960
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8961
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8962
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8963
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8964
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8965
	    if (fun != -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8966
		ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8967
		XSetFunction(myDpy, gc, fun);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8968
		LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8969
		RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8970
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8971
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8972
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8973
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8974
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8975
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8976
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8977
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8978
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8979
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8980
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8981
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8982
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8983
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8984
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8985
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8986
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8987
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8988
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8989
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8990
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8991
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8992
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8993
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8994
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8995
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8996
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8997
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8998
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8999
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9000
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9001
    "set line attributes;
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9002
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9003
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9004
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9005
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9006
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9007
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9008
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9009
    int x_style, x_cap, x_join;
6768
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9010
    static char dotList[2] = { 1,1 };
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9011
    static char dashList[2]  = { 4,4 };
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9012
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9013
    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
  9014
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9015
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9016
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9017
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9018
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9019
	 && __isSmallInteger(aNumber)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9020
	    Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9021
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9022
	    if (lineStyle == @symbol(solid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9023
		x_dashes = (char *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9024
		x_style = LineSolid;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9025
	    } else if (lineStyle == @symbol(dashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9026
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9027
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9028
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9029
	    } else if (lineStyle == @symbol(doubleDashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9030
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9031
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9032
		x_style = LineDoubleDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9033
	    } else if (lineStyle == @symbol(dotted)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9034
		x_dashes = dotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9035
		x_nDash = sizeof(dotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9036
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9037
	    } else if (lineStyle == @symbol(dashDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9038
		x_dashes = dashDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9039
		x_nDash = sizeof(dashDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9040
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9041
	    } else if (lineStyle == @symbol(dashDotDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9042
		x_dashes = dashDotDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9043
		x_nDash = sizeof(dashDotDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9044
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9045
	    } else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9046
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9047
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9048
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9049
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9050
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9051
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9052
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9053
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9054
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9055
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9056
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9057
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9058
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9059
	    if (x_dashes) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9060
		XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9061
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9062
	    XSetLineAttributes(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9063
			       __GCVal(aGCId), __intVal(aNumber),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9064
			       x_style, x_cap, x_join);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9065
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9066
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9067
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9068
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9069
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9070
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9071
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9072
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9073
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9074
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9075
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9076
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9077
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9078
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9079
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9080
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9081
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9082
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9083
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9084
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9085
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9086
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9087
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9088
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9089
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9090
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9091
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9092
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9093
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9094
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9095
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9096
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9097
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9098
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9099
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9100
    "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
  9101
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9102
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9103
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9104
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9105
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9106
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9107
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9108
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9109
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9110
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9111
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9112
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9113
	    if (__isExternalAddress(aPixmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9114
		pixmap = __PixmapVal(aPixmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9115
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9116
		XSetTile(dpy, gc, pixmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9117
		XSetFillStyle(dpy, gc, FillTiled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9118
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9119
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9120
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9121
	    if (aPixmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9122
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9123
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9124
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9125
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9126
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9127
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9128
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9129
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9130
    self primitiveFailedOrClosedConnection
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9131
!
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9132
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9133
setPlaneMask:bits in:aGCId
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9134
    "set foreground color to be drawn with"
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9135
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9136
    <context: #return>
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9137
%{
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9138
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9139
	if (__isExternalAddress(aGCId)
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9140
	 && __isSmallInteger(bits)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9141
	    unsigned long mask = __intVal(bits);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9142
	    if (__intVal(bits) == -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9143
		mask = AllPlanes;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9144
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9145
	    ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9146
	    XSetPlaneMask(myDpy, __GCVal(aGCId), mask);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9147
	    LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9148
	    RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9149
	}
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9150
    }
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9151
%}.
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9152
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9153
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9154
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  9155
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9156
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9157
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9158
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9159
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9160
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9161
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9162
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9163
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9164
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  9165
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9166
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9167
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9168
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9169
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9170
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9171
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9172
	XCloseDisplay(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9173
	LEAVE_XLIB();
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
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9176
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9177
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9178
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9179
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9180
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9181
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9182
%{
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9183
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9184
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9185
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9186
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9187
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9188
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9189
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9190
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9191
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9192
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9193
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9194
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9195
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9196
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9197
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9198
getWindowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9199
    "Creates a fake WindowGroup view. This window is used
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9200
     in XWMHints & _NET_WM_LEADER properties to define
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9201
     application window group"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9202
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9203
    windowGroupWindow isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9204
	windowGroupWindow := WindowGroupWindow new create.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9205
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9206
    ^ windowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9207
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9208
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9209
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  9210
    activateOnClick := false.
6156
dd328de0a324 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6154
diff changeset
  9211
    maxOperationsUntilFlush := nil.
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  9212
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  9213
    super initializeDefaultValues.
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9214
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9215
    "JV@2012: On X11, mouse buttons are: left=1, middle=2, right=3
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9216
    Even on 2-button mouse (button 2 is simply not reported).
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9217
    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
  9218
    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
  9219
    is somewhat special value.
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9220
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9221
    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
  9222
    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
  9223
7478
4865dd2c05c9 #OTHER by mawalch
mawalch
parents: 7443
diff changeset
  9224
    Also note that buttonTranslation is overwritten in display.rc,
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9225
    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
  9226
    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
  9227
    "
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9228
6092
92572b3d40ea you shalt not modify literal arrays
Claus Gittinger <cg@exept.de>
parents: 6064
diff changeset
  9229
    buttonTranslation := buttonTranslation copy.
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9230
    buttonTranslation at: 2 put: #paste
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9231
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9232
    "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
  9233
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9234
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9235
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9236
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9237
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  9238
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  9239
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9240
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9241
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9242
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9243
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9244
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9245
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9246
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9247
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9248
     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
  9249
     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
  9250
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9251
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9252
    displayId notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9253
	"/ already connected - you bad guy try to trick me manually ?
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9254
	^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9255
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9256
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9257
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9258
    displayId isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9259
	"/ could not connect.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9260
	DeviceOpenErrorSignal raiseWith:aDisplayName.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9261
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9262
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9263
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9264
    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9265
    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  9266
    hasConnectionBroken := false.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9267
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9268
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9269
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9270
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9271
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9272
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9273
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9274
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9275
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9276
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9277
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9278
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9279
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9280
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9281
    atoms := nil.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9282
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9283
    "These values are initialized by primitive code in #createWindowFor:..."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9284
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9285
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9286
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9287
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9288
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9289
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9290
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9291
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9292
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9293
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9294
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9295
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9296
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9297
    Screen default isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9298
	"not initialized yet?"
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9299
	self initializeViewStyle.
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9300
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9301
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9302
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9303
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9304
    "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
  9305
     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
  9306
     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
  9307
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9308
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9309
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9310
    super initializeModifierMappings.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9311
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9312
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9313
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9314
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9315
    map isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9316
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9317
	"/ mhmh - a crippled Xlib which does not provide modifier mappings
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9318
	"/ setup some reasonable default. If that is not sufficient,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9319
	"/ you have to change things from your display.rc file.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9320
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9321
	altModifierMask := self modifier1Mask.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9322
	metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9323
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9324
	| mod symbolFromKeyCode nonNilOnes |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9325
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9326
	altModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9327
	metaModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9328
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9329
	symbolFromKeyCode := [:key | self symbolFromKeycode:key].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9330
	nonNilOnes := [:str | str notNil].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9331
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9332
	mod := map at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9333
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9334
	    shiftModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9335
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9336
	mod := map at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9337
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9338
	    ctrlModifiers  := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9339
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9340
	mod := map at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9341
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9342
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9343
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9344
		metaModifiers := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9345
		metaModifierMask := 1 bitShift:(4-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9346
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9347
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9348
	mod := map at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9349
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9350
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9351
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9352
		altModifiers   := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9353
		altModifierMask := 1 bitShift:(5-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9354
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9355
	]
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9356
    ].
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9357
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9358
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9359
     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
  9360
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9361
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9362
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9363
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9364
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9365
initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9366
    self isXineramaActive ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9367
	|rect|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9368
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9369
	self monitorBounds do:[:eachRect|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9370
	    rect isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9371
		rect := eachRect.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9372
	    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9373
		rect := rect merge:eachRect.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9374
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9375
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9376
	width := rect width.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9377
	height := rect height.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9378
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9379
	"propagate possible size changes to our rottView"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9380
	rootView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9381
	    rootView initialize.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9382
	].
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9383
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9384
	width := self queryWidth.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9385
	height := self queryHeight.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9386
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9387
    widthMM := self queryWidthMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9388
    heightMM := self queryHeightMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9389
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9390
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9391
      Display initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9392
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9393
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9394
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9395
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9396
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9397
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9398
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9399
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9400
    hasShapeExtension := self hasExtension:#SHAPE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9401
    hasShmExtension := self hasExtension:#MIT_SHM.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9402
    hasDPSExtension := self hasExtension:#DPS.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9403
    hasXVideoExtension := self hasExtension:#XVideo.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9404
    hasMbufExtension := self hasExtension:#'Multi-Buffering'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9405
    hasPEXExtension := self hasExtension:#'X3D-PEX'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9406
    hasImageExtension := self hasExtension:#XIE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9407
    hasInputExtension := self hasExtension:#XInputExtension.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9408
    hasXineramaExtension := self hasExtension:#XINERAMA.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9409
    hasRenderExtension := self hasExtension:#RENDER.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9410
    hasXftLibrary := hasRenderExtension and:[self class hasXftLibrary].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9411
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9412
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9413
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9414
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9415
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9416
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9417
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9418
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9419
    screen := self queryDefaultScreen.
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9420
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9421
    self initializeScreenBounds.
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9422
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9423
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9424
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9425
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9426
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9427
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9428
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9429
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9430
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9431
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9432
    (visualType == #StaticGray
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9433
     or:[ visualType == #GrayScale]) ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9434
	hasColors := false.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9435
	monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9436
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9437
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9438
    ncells == 2 ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9439
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9440
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9441
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9442
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9443
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9444
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9445
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9446
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9447
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9448
    visualType == #TrueColor ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9449
	redShift := redMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9450
	greenShift := greenMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9451
	blueShift := blueMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9452
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9453
	bitsRed := redMask highBit - redMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9454
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9455
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9456
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9457
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  9458
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9459
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9460
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9461
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9462
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9463
    XVisualInfo viproto;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9464
    XVisualInfo *vip;                   /* returned info */
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9465
    int maxRGBDepth, maxRGBADepth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9466
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9467
    int rgbaRedMask, rgbaGreenMask, rgbaBlueMask, rgbaAlphaMask;
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9468
    int rgbVisualID, rgbaVisualID;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9469
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9470
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9471
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9472
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9473
    if (ISCONNECTED) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9474
	dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9475
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9476
	/*
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9477
	 * look for RGB visual with the highest depth
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9478
	 */
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9479
	nvi = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9480
	viproto.screen = scr;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9481
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9482
	maxRGBDepth = maxRGBADepth = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9483
	for (i = 0; i < nvi; i++) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9484
	    int thisDepth = vip[i].depth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9485
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9486
	    switch (vip[i].class) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9487
		case TrueColor:
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9488
		    if (thisDepth > maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9489
			if (thisDepth <= 24) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9490
			    maxRGBDepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9491
			    rgbRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9492
			    rgbGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9493
			    rgbBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9494
			    rgbVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9495
			} else {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9496
			    if (thisDepth > maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9497
				// printf("found rgba visual!\n");
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9498
				maxRGBADepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9499
				rgbaRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9500
				rgbaGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9501
				rgbaBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9502
				rgbaVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9503
			    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9504
			}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9505
		    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9506
		    break;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9507
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9508
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9509
	if (vip) XFree ((char *) vip);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9510
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9511
	if (maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9512
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9513
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9514
	if (maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9515
	    __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9516
	    if (!maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9517
		__INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9518
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9519
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9520
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9521
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9522
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9523
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9524
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9525
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9526
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9527
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9528
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9529
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9530
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9531
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9532
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9533
    (self serverVendor = 'X11/NeWS') ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9534
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9535
	"/ this is a kludge around a bug in the X11/NeWS server,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9536
	"/ which does not correctly handle saveUnder
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9537
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9538
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9539
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9540
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9541
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9542
initializeUniqueID
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9543
    uniqueDeviceID isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9544
	uniqueDeviceID := UUID genUUID.
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9545
    ]
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9546
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9547
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9548
invalidateConnection
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9549
    super invalidateConnection.
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9550
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9551
    "the new display may support a different set of fonts"
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9552
    self flushListOfAvailableFonts
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9553
!
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9554
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9555
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9556
    "open a connection to some display;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9557
     return the displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9558
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  9559
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9560
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9561
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9562
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9563
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  9564
    if (__isStringLike(dpyName))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9565
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9566
    else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9567
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9568
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9569
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9570
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9571
    if (dpy) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9572
	static int firstCall = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9573
	OBJ dpyID;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9574
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9575
	dpyID = __MKEXTERNALADDRESS(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9576
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9577
	if (firstCall) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9578
	    firstCall = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9579
	    XSetErrorHandler(__XErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9580
	    XSetIOErrorHandler(__XIOErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9581
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9582
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9583
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9584
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9585
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9586
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9587
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9588
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9589
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9590
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9591
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9592
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9593
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9594
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9595
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9596
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9597
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9598
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9599
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9600
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9601
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9602
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9603
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9604
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9605
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9606
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9607
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9608
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9609
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9610
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9611
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9612
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9613
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9614
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9615
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9616
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9617
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9618
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9619
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9620
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9621
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9622
     Display queryCells
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9623
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9624
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9625
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9626
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9627
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9628
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9629
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9630
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9631
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9632
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9633
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9634
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9635
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9636
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9637
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9638
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9639
     Display queryDefaultScreen
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9640
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9641
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9642
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9643
queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9644
%{  /* NOCONTEXT */
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9645
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9646
    if (ISCONNECTED) {
6762
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9647
	Display *dpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9648
	Visual *visual;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9649
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9650
	dpy = myDpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9651
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9652
	RETURN ( __MKEXTERNALADDRESS( visual ) );
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9653
    }
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9654
%}.
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9655
    ^ nil
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9656
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9657
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9658
     Display queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9659
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9660
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9661
    "Created: / 22-09-2014 / 10:05:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9662
!
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9663
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9664
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9665
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9666
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9667
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9668
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9669
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9670
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9671
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9672
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9673
	switch (visual->class) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9674
	    case StaticGray:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9675
		RETURN ( @symbol(StaticGray) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9676
	    case GrayScale:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9677
		RETURN ( @symbol(GrayScale) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9678
	    case StaticColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9679
		RETURN ( @symbol(StaticColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9680
	    case PseudoColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9681
		RETURN ( @symbol(PseudoColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9682
	    case TrueColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9683
		RETURN ( @symbol(TrueColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9684
	    case DirectColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9685
		RETURN ( @symbol(DirectColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9686
	}
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9687
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9688
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9689
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9690
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9691
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9692
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9693
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9694
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9695
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9696
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9697
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9698
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9699
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9700
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9701
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9702
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9703
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9704
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9705
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9706
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9707
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9708
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9709
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9710
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9711
     Display queryDepth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9712
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9713
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9714
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9715
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9716
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9717
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9718
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9719
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9720
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9721
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9722
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9723
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9724
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9725
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9726
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9727
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9728
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9729
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9730
     Display queryHeight
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9731
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9732
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9733
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9734
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9735
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9736
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9737
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9738
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9739
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9740
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9741
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9742
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9743
	RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9744
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9745
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9746
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9747
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9748
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9749
     Display queryHeightMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9750
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9751
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9752
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9753
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9754
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9755
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9756
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9757
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9758
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9759
	OBJ redMask, greenMask, blueMask, bprgb;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9760
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9761
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9762
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9763
	redMask   = __MKSMALLINT(visual->red_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9764
	greenMask = __MKSMALLINT(visual->green_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9765
	blueMask  = __MKSMALLINT(visual->blue_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9766
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9767
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9768
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9769
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9770
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9771
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9772
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9773
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9774
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9775
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9776
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9777
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9778
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9779
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9780
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9781
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9782
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9783
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9784
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9785
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9786
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9787
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9788
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9789
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9790
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9791
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9792
     Display queryWhitePixel
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9793
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9794
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9795
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9796
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9797
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9798
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9799
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9800
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9801
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9802
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9803
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9804
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9805
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9806
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9807
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9808
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9809
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9810
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9811
     Display queryWidth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9812
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9813
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9814
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9815
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9816
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9817
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9818
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9819
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9820
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9821
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9822
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9823
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9824
	RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9825
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9826
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9827
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9828
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9829
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9830
     Display queryWidthMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9831
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9832
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9833
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9834
reinitialize
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9835
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9836
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9837
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9838
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9839
    virtualRootId := rootId := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9840
    selectionFetchers := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9841
    dispatchingExpose := nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9842
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9843
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9844
releaseDeviceResources
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9845
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9846
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9847
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9848
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9849
    selectionFetchers := nil.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9850
    super releaseDeviceResources.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9851
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9852
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9853
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9854
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9855
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9856
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9857
     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
  9858
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9859
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9860
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9861
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9862
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9863
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9864
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9865
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9866
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9867
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9868
     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
  9869
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9870
     and the setting can be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9871
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9872
     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
  9873
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9874
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9875
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9876
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9877
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9878
appleAltModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9879
    "return the Xlib mask bit for the ALT modifier key on OS-X.
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9880
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9881
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9882
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  9883
	^ 8192
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9884
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9885
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9886
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9887
    "Created: / 10-02-2017 / 21:32:13 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9888
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9889
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9890
appleCmdModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9891
    "return the Xlib mask bit for the CMD modifier key on OS-X.
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9892
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9893
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9894
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  9895
	^ 16
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9896
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9897
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9898
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9899
    "Created: / 10-02-2017 / 21:32:50 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9900
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9901
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9902
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9903
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9904
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9905
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9906
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9907
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9908
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9909
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9910
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9911
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9912
     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
  9913
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9914
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9915
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9916
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9917
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9918
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9919
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9920
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9921
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9922
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9923
     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
  9924
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9925
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9926
     be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9927
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9928
     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
  9929
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9930
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9931
     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
  9932
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9933
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9934
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9935
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9936
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9937
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9938
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9939
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9940
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9941
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9942
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9943
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9944
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9945
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9946
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9947
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9948
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9949
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9950
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9951
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9952
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9953
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9954
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9955
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9956
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9957
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9958
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9959
    "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
  9960
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9961
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9962
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9963
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9964
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9965
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9966
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9967
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9968
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9969
    "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
  9970
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9971
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9972
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9973
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9974
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9975
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9976
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9977
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9978
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9979
    "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
  9980
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9981
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9982
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9983
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9984
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9985
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9986
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9987
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9988
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9989
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9990
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9991
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9992
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9993
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9994
    modifierKeyMap := self rawModifierMapping.
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
  9995
    modifierKeyMap isEmptyOrNil ifTrue:[^ nil].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9996
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9997
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9998
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9999
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10000
    1 to:8 do:[ :i |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10001
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10002
	    |mod|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10003
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10004
	    mod := OrderedCollection new:maxKeyPerMod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10005
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10006
		key ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10007
		    mod add:key
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10008
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10009
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10010
	    ret at:i put:mod asArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10011
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10012
	nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10013
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10014
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10015
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10016
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10017
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10018
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10019
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10020
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10021
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10022
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10023
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10024
     mapping := Display modifierMapping.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10025
     ^ mapping collect:[:eachRow |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10026
			     eachRow notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10027
				 eachRow collect:[ :key | Display stringFromKeycode:key ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10028
			     ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10029
				 nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10030
			     ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10031
		       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10032
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10033
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10034
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10035
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10036
    "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
 10037
     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
 10038
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10039
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10040
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10041
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10042
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10043
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10044
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10045
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10046
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10047
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10048
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10049
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
 10050
    |modifierKeyMap|
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10051
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10052
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10053
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10054
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10055
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10056
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10057
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10058
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10059
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10060
	   if (modifierKeyMap != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10061
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10062
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10063
	   }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10064
	   XFreeModifiermap(modmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10065
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10066
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10067
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10068
    ^ modifierKeyMap
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10069
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10070
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10071
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10072
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10073
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10074
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10075
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10076
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10077
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10078
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10079
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10080
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10081
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10082
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10083
superModifierMask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10084
    "return the Xlib mask bit for the super modifier key"
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10085
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10086
    ^ self modifier4Mask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10087
!
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10088
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10089
symbolFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10090
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10091
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10092
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10093
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10094
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10095
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10096
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10097
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10098
    if (ISCONNECTED && __isSmallInteger(code)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10099
	Display *dpy = myDpy;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10100
5983
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10101
// Our Windows Xlib does not support Xkb as of 2013-01
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10102
//        if ((keysym = XkbKeycodeToKeysym(dpy, __intVal(code), 0, 0)) != NoSymbol
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10103
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10104
	    && (keystring = XKeysymToString(keysym)) != 0)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10105
	    str = __MKSYMBOL(keystring, 0);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10106
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10107
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10108
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10109
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10110
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10111
	Display symbolFromKeycode:50
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10112
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10113
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10114
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10115
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10116
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10117
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10118
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10119
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10120
    UserPreferences current beepEnabled ifTrue:[
6762
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
 10121
	self beep:0 volume:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
 10122
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10123
6758
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10124
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10125
     Screen current beep
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10126
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10127
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10128
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10129
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10130
5247
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10131
beep:aSymbolOrInteger volume:volumeInPercent
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10132
    "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
 10133
     (kept for comaptibilty with WinWorkstation)."
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10134
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10135
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10136
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10137
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10138
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10139
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10140
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10141
	/* stupid: X wants -100 .. 100 and calls this percent */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10142
	volume = __intVal(volumeInPercent) * 2 - 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10143
	if (volume < -100) volume = -100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10144
	else if (volume > 100) volume = 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10145
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10146
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10147
	XBell(myDpy, volume);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10148
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10149
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10150
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10151
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10152
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10153
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10154
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10155
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10156
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10157
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10158
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10159
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10160
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10161
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10162
	XSynchronize(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10163
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10164
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10165
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10166
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10167
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10168
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10169
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10170
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10171
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10172
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10173
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10174
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10175
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10176
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10177
     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
 10178
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10179
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10180
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10181
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10182
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10183
	XFlush(myDpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10184
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10185
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10186
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10187
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10188
    operationsUntilFlush := maxOperationsUntilFlush.
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10189
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10190
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10191
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10192
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10193
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10194
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10195
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10196
	&& __isExternalAddress(aDPSContext)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10197
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10198
	DPSFlushContext(__DPSContextVal(aDPSContext));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10199
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10200
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10201
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10202
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10203
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10204
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10205
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10206
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10207
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10208
flushIfAppropriate
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10209
    "flush the device, if necessary"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10210
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10211
    operationsUntilFlush notNil ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10212
	operationsUntilFlush <= 0 ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10213
	    self flush.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10214
	    ^ true.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10215
	] ifFalse:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10216
	    operationsUntilFlush := operationsUntilFlush - 1.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10217
	].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10218
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10219
    ^ false.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10220
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10221
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10222
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10223
    "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
 10224
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10225
     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
 10226
     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
 10227
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10228
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10229
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10230
%{
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10231
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10232
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10233
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10234
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10235
	XSync(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10236
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10237
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10238
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10239
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10240
    operationsUntilFlush := maxOperationsUntilFlush.
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10241
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10242
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10243
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10244
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10245
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10246
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10247
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10248
    if (ISCONNECTED && __isByteArrayLike(eB)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10249
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10250
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10251
	XRefreshKeyboardMapping(ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10252
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10253
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10254
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10255
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10256
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10257
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10258
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10259
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10260
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10261
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10262
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10263
    self sync.
4119
a770b7e08c72 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4114
diff changeset
 10264
    ^ Timestamp millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10265
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10266
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10267
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10268
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10269
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10270
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10271
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10272
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10273
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10274
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10275
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10276
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10277
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10278
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10279
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10280
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10281
     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
 10282
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10283
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10284
     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
 10285
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10286
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10287
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10288
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10289
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10290
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10291
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10292
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10293
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10294
	    focusWindow = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10295
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10296
	    focusWindow = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10297
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10298
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10299
	if (revertSymbol == @symbol(parent))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10300
	    arg = RevertToParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10301
	else if (revertSymbol == @symbol(root))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10302
	    arg = RevertToPointerRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10303
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10304
	    arg = RevertToNone;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10305
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10306
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10307
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10308
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10309
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10310
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10311
	RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10312
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10313
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10314
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10315
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10316
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10317
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10318
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10319
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10320
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10321
     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
 10322
     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
 10323
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10324
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10325
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10326
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10327
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10328
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10329
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10330
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10331
     This makes all graphics synchronous and turns off any buffering
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10332
     (i.e. each individual draw-request is sent immediately without
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10333
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10334
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10335
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10336
     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
 10337
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10338
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10339
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10340
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10341
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10342
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10343
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10344
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10345
	XSynchronize(myDpy, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10346
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10347
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10348
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10349
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10350
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10351
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10352
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10353
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10354
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10355
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10356
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10357
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10358
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10359
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10360
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10361
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10362
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10363
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10364
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10365
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10366
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10367
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10368
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10369
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10370
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10371
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10372
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10373
     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
 10374
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10375
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10376
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10377
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10378
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10379
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10380
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10381
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10382
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10383
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10384
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10385
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10386
	w = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10387
	if (w) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10388
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10389
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10390
	    XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10391
				 &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10392
				 &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10393
				 &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10394
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10395
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10396
	    RETURN (__MKSMALLINT(mask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10397
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10398
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10399
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10400
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10401
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10402
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10403
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10404
     Display buttonStates
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10405
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10406
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10407
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10408
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10409
     Display buttonStates bitTest:(Display controlMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10410
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10411
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10412
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10413
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10414
     Display buttonStates bitTest:(Display altModifierMask)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10415
     Display buttonStates bitTest:(Display metaModifierMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10416
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10417
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10418
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10419
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10420
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10421
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10422
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10423
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10424
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10425
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10426
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10427
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10428
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10429
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10430
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10431
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10432
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10433
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10434
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10435
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10436
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10437
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10438
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10439
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10440
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10441
pointerPosition
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10442
    "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
 10443
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10444
    <context: #return>
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10445
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10446
    |xpos ypos rootWindowId|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10447
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10448
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10449
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10450
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10451
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10452
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10453
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10454
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10455
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10456
    if (ISCONNECTED && rootWindowId != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10457
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10458
	Window w = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10459
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10460
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10461
	XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10462
			      &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10463
			      &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10464
			      &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10465
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10466
	xpos = __MKSMALLINT(rootX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10467
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10468
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10469
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10470
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10471
    xpos isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10472
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10473
	^ nil
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10474
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10475
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10476
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10477
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10478
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10479
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10480
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10481
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10482
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10483
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10484
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10485
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10486
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10487
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10488
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10489
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10490
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10491
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10492
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10493
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10494
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10495
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10496
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10497
    "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
 10498
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
 10499
     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
 10500
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10501
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10502
     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
 10503
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10504
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10505
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10506
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10507
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10508
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10509
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10510
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10511
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10512
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10513
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10514
     && __bothSmallInteger(xpos, ypos)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10515
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10516
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10518
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10519
	XWarpPointer(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10520
		     None,  /* src window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10521
		     w,  /* dst window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10522
		     0,  /* src_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10523
		     0,  /* src_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10524
		     0,  /* src_w */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10525
		     0,  /* src_h */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10526
		     __intVal(xpos),  /* dst_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10527
		     __intVal(ypos)   /* dst_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10528
		    );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10529
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10530
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10531
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10532
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10533
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10534
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10535
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10536
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10537
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10538
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10539
!XWorkstation methodsFor:'private'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10540
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10541
addSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10542
    "register someone to be notified when the selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10543
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10544
    selectionHandlers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10545
	selectionHandlers := IdentitySet new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10546
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10547
    selectionHandlers add:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10548
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10549
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10550
findSelectionFetcher:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10551
    "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
 10552
     Answer nil, if there is none"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10553
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10554
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10555
	^ nil.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10556
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10557
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10558
    ^ selectionFetchers at:aDrawableId ifAbsent:[].
4252
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
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10561
registerSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10562
    "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
 10563
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10564
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10565
	selectionFetchers := Dictionary new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10566
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10567
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10568
    selectionFetchers at:aSelectionFetcher drawableID put:aSelectionFetcher.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10569
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10570
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10571
removeSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10572
    "no longer tell someone about selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10573
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10574
    selectionHandlers notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10575
	selectionHandlers remove:someone ifAbsent:nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10576
	selectionHandlers := selectionHandlers asNilIfEmpty
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10577
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10578
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10579
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10580
unregisterSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10581
    "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
 10582
8053
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10583
    selectionFetchers removeKey:(aSelectionFetcher drawableID) ifAbsent:[].
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10584
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10585
    "Modified (format): / 24-07-2017 / 15:04:08 / cg"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10586
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10587
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10588
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10589
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10590
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10591
    "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
 10592
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10593
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10594
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10595
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10596
    if (ISCONNECTED && __isAtomID(propertyID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10597
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10598
	Atom prop;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10599
	Window window;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10600
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10601
	prop = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10602
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10603
	if (__isExternalAddress(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10604
	    window = __WindowVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10605
	} else if (aWindowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10606
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10607
	} else if (__isInteger(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10608
	    window = (Window)__unsignedLongIntVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10609
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10610
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10611
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10612
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10613
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10614
	XDeleteProperty(dpy, window, prop);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10615
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10616
	RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10617
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10618
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10619
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10620
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10621
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10622
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10623
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10624
    "get a property as an association propertyType->propertyValue"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10625
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10626
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10627
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10628
    |val typeID propertyID windowID|
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10629
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10630
    propertySymbolOrAtomID isString ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10631
	propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10632
	propertyID isNil ifTrue:[^ nil].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10633
    ] ifFalse:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10634
	propertyID := propertySymbolOrAtomID.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10635
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10636
    aWindowOrWindowIDOrNil isView ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10637
	windowID := aWindowOrWindowIDOrNil id.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10638
    ] ifFalse:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10639
	windowID := aWindowOrWindowIDOrNil.
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10640
    ].
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10641
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10642
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10643
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10644
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10645
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10646
    Atom actual_type;
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10647
    int actual_format;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10648
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10649
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10650
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10651
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10652
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10653
    if (ISCONNECTED) {
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10654
	Display *dpy = myDpy;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10655
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10656
	if (__isAtomID(propertyID)) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10657
	    property = __AtomVal(propertyID);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10658
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10659
	    if (__isExternalAddress(windowID)) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10660
		window = __WindowVal(windowID);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10661
	    } else if (windowID == nil) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10662
		window = DefaultRootWindow(dpy);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10663
	    } else
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10664
		goto fail;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10665
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10666
	    nread = 0;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10667
	    cp = 0;
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10668
#ifdef PROPERTY_DEBUG
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10669
	    console_fprintf(stderr, "getProperty %x\n", property);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10670
#endif
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10671
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10672
	    do {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10673
		int retVal;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10674
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10675
		ENTER_XLIB();
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10676
		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10677
					    doDelete == true,
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10678
					    AnyPropertyType, &actual_type, &actual_format,
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10679
					    &nitems, &bytes_after, (unsigned char **)&data);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10680
		LEAVE_XLIB();
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10681
		if (retVal != Success) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10682
#ifdef PROPERTY_DEBUG
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10683
		    console_fprintf(stderr, "- no success\n");
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10684
#endif
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10685
		    ok = 0;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10686
		    break;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10687
		}
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10688
#ifdef PROPERTY_DEBUG
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10689
		console_fprintf(stderr, "- type:%x\n", actual_type);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10690
#endif
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10691
		nitems *= (actual_format / 8);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10692
		typeID = __MKATOMOBJ(actual_type);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10693
		if (! cp) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10694
		    cp = cp2 = (char *)malloc(nitems+bytes_after);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10695
		} else {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10696
		    cp2 = cp + nread;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10697
		}
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10698
		if (! cp) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10699
		    XFree(data);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10700
		    goto fail;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10701
		}
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10702
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10703
		nread += nitems;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10704
		bcopy(data, cp2, nitems);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10705
		XFree(data);
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10706
#ifdef PROPERTY_DEBUG
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10707
		console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10708
#endif
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10709
	    } while (bytes_after > 0);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10710
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10711
	    if (ok) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10712
		switch (actual_format) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10713
		case 32:
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10714
		    // bad design: even though it says "32",
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10715
		    // what is really returned are longs.
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10716
		    // this does make a difference on 64bit machines!
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10717
		    val = __stArrayFromCULongArray((unsigned long*)cp, nread/sizeof(long));
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10718
		    break;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10719
		case 16:
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10720
		    val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10721
		    break;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10722
		case 8:
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10723
		default:
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10724
		    if (actual_type == XA_STRING) {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10725
			val = __MKSTRING_L(cp, nread);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10726
		    } else {
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10727
			val = __MKBYTEARRAY(cp, nread);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10728
		    }
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10729
		    break;
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10730
		}
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10731
	    }
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10732
	    if (cp)
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10733
		free(cp);
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10734
	}
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10735
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10736
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10737
%}.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 10738
    (typeID isNil or:[typeID == 0]) ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10739
	"typeID == 0 (None): The property does not exist in the specified window"
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10740
	^ nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10741
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10742
    ^ typeID->val
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
 10743
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
 10744
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10745
     Display
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10746
	getProperty:#'_NET_WM_ICON_GEOMETRY'
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10747
	from:nil
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10748
	delete:false
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10749
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10750
     Display
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10751
	getProperty:#'_NET_SUPPORTED'
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10752
	from:nil
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10753
	delete:false
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10754
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10755
     Transcript showCR:(
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10756
	 (Display
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10757
	    getProperty:#'_NET_SUPPORTED'
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10758
	    from:nil
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10759
	    delete:false)
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10760
		value
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10761
		    collect:[:eachID | Display atomName:eachID])
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
 10762
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10763
    "
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10764
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10765
    "Modified: / 31-08-2017 / 22:01:44 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10766
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10767
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10768
propertiesOf:aWindowOrWindowIDOrNil
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10769
    "return a collection of all properties' atomIDs of a window.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10770
     Returns the rootWindows props for a nil window argument."
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10771
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10772
    <context: #return>
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10773
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10774
    |windowID atoms|
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10775
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10776
    aWindowOrWindowIDOrNil isView ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10777
	windowID := aWindowOrWindowIDOrNil id.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10778
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10779
	windowID := aWindowOrWindowIDOrNil.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10780
    ].
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10781
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10782
%{
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10783
    Window window;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10784
    Atom *atomListPtr;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10785
    int i;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10786
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10787
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10788
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10789
	int numProps = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10790
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10791
	if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10792
	    window = __WindowVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10793
	} else if (windowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10794
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10795
	} else if (__isInteger(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10796
	    window = (Window)__unsignedLongIntVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10797
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10798
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10799
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10800
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10801
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10802
	atomListPtr = XListProperties(dpy, window, &numProps);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10803
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10804
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10805
	if (atomListPtr == NULL) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10806
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10807
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10808
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10809
	atoms = __ARRAY_NEW_INT(numProps);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10810
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10811
	if (atoms == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10812
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10813
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10814
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10815
	for (i=0; i<numProps; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10816
	    OBJ atm;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10817
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10818
	    atm = __MKATOMOBJ(atomListPtr[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10819
	    __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10820
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10821
	XFree(atomListPtr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10822
	RETURN (atoms);
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10823
    }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10824
fail: ;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10825
%}.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10826
    ^ self primitiveFailed
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10827
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10828
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10829
     Display propertiesOf:nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10830
     Display propertiesOf:Transcript view id
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10831
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10832
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10833
     (Display propertiesOf:nil) do:[:atm |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10834
	|v prop|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10835
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10836
	Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10837
	Transcript show:': '.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10838
	prop := Display getProperty:atm from:nil delete:false.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10839
	Transcript showCR:prop value.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10840
     ]
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10841
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10842
!
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10843
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10844
setIcon:anIcon for:aWindowID
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10845
    |iconAtom typeAtom buffer iWidth iHeight|
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10846
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10847
    iconAtom := self atomIDOf:#'_NET_WM_ICON' create:false.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10848
    iconAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10849
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10850
	^ self
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10851
    ].
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10852
    typeAtom := self atomIDOf:#'CARDINAL' create:false.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10853
    typeAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10854
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10855
	^ self
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10856
    ].
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10857
    iWidth  := anIcon width.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10858
    iHeight := anIcon height.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10859
    buffer := IntegerArray new:(iWidth*iHeight+2).
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10860
    buffer at:1 put:iWidth.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10861
    buffer at:2 put:iHeight.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10862
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10863
    self setProperty:iconAtom type:typeAtom value:buffer for:aWindowID
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10864
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10865
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10866
	Display setIcon:0 for:0
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10867
    "
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10868
!
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10869
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10870
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10871
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10872
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10873
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 10874
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10875
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10876
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10877
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10878
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10879
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10880
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10881
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10882
	Atom prop, type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10883
	Window window;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10884
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10885
	prop = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10886
	type = __AtomVal(typeID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10887
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10888
	if (__isExternalAddress(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10889
	    window = __WindowVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10890
	} else if (aWindowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10891
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10892
	} else if (__isInteger(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10893
	    window = (Window)__unsignedLongIntVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10894
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10895
	    RETURN(false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10896
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10897
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10898
	retval = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10899
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10900
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10901
	if (__isInteger(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10902
	    unsigned INT value = __longIntVal(anObject);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10903
	    XChangeProperty(dpy, window, prop, type, 32,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10904
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10905
			    (unsigned char *)&value, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10906
	} else if (__isByteArrayLike(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10907
	    XChangeProperty(dpy, window, prop, type, 8,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10908
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10909
			    __byteArrayVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10910
			    __byteArraySize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10911
	} else if (__isWords(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10912
	    /* wordArray-like (16bit-string) object */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10913
	    XChangeProperty(dpy, window, prop, type, 16,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10914
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10915
			    __stringVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10916
			    __wordArraySize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10917
	} else if (__isIntegerArray(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10918
	    /* array of atoms */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10919
	    XChangeProperty(dpy, window, prop, type, 32,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10920
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10921
			    (char *)__integerArrayVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10922
			    __integerArraySize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10923
	} else if (__isStringLike(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10924
	    XChangeProperty(dpy, window, prop, type, 8,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10925
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10926
			    __stringVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10927
			    __stringSize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10928
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10929
	    retval = false;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10930
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10931
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10932
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10933
	DPRINTF(("changeProp win=%"_lx_" prop=%"_lx_" type=%"_lx_"\n", (INT)window, (INT)prop, (INT)type));
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10934
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10935
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10936
    ^ retval
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10937
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10938
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10939
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10940
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10941
defaultExtentForTopViews
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10942
    "redefined, to define the default extent for the default monitor"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10943
    |extent|
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10944
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10945
    "the standard monitor is the first entry in monitorBounds"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10946
    extent := self monitorBounds first extent.
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10947
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10948
    self isPDA ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10949
	^ extent - (16 @ 20)
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10950
    ].
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10951
    ^ extent * 2 // 3
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10952
!
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10953
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10954
isOpen
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10955
    "answer true, if device can be used"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10956
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10957
    ^ displayId notNil and:[hasConnectionBroken not].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10958
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10959
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10960
isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10961
%{  /* NOCONTEXT */
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10962
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10963
#ifdef XINERAMA
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10964
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10965
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10966
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10967
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10968
	if (XineramaIsActive(dpy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10969
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10970
	}
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10971
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10972
#endif
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10973
%}.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10974
    ^ false
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10975
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10976
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10977
     Display isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10978
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10979
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10980
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10981
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10982
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10983
atomIDOf:aStringOrSymbol
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 10984
    "return an X11 atoms ID.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10985
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10986
     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
 10987
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10988
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10989
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10990
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10991
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10992
     Display atomIDOf:#'FACE_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10993
     Display atomIDOf:#'FULL_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10994
     Display atomIDOf:#DndProtocol
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10995
     Display atomIDOf:#DndSelection
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10996
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10997
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10998
    "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
 10999
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11000
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11001
atomIDOf:aStringOrSymbol create:create
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11002
    "return an Atoms ID given its name.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11003
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11004
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11005
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11006
     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
 11007
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11008
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11009
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11010
    atomSymbol := aStringOrSymbol asSymbol.
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
 11011
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:[nil]) notNil]) ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11012
	^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11013
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11014
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11015
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11016
    atom notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11017
	atoms isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11018
	    atoms := IdentityDictionary new.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11019
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11020
	atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11021
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11022
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11023
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11024
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11025
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11026
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11027
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11028
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11029
     Display atomIDOf:'PRIMARY' create:false
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11030
     Display atomIDOf:'blabla' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11031
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11032
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11033
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11034
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11035
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11036
     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
 11037
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11038
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11039
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11040
%{
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11041
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11042
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11043
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11044
    if (ISCONNECTED && __isAtomID(anAtomID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11045
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11046
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11047
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11048
	if (name == 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11049
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11050
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11051
	str = __MKSTRING(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11052
	XFree(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11053
	RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11054
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11055
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11056
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11057
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11058
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11059
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11060
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11061
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11062
     Display atomName:132  'FONTNAME_REGISTRY'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11063
     Display atomName:135 'FOUNDRY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11064
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11065
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11066
     Display atomName:152 'CHARSET_ENCODING'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11067
     Display atomName:154
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11068
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11069
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11070
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11071
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11072
    "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
 11073
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11074
     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
 11075
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11076
     Notice:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11077
	we do not plan to use X's resources for ST/X's defaults,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11078
	styles or resources. This would make porting of applications
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11079
	to different platforms much more difficult (Windows has no resource
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11080
	database). If you stay within ST/X's resource files, these can be
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11081
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11082
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11083
     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
 11084
     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
 11085
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11086
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11087
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11088
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11089
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11090
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11091
     && __isStringLike(name)
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11092
     && __isStringLike(cls)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11093
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11094
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11095
				  (char *) __stringVal(name));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11096
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11097
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11098
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11099
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11100
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11101
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11102
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11103
    "if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11104
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11105
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11106
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11107
	 Display getResource:'Beep' class:'OpenWindows'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11108
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11109
     if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11110
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11111
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11112
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11113
	 Display getResource:'beNiceToColormap' class:'any'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11114
	 Display getResource:'beNiceToColormap' class:''
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11115
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11116
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11117
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11118
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11119
    "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
 11120
     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
 11121
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11122
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11123
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11124
%{
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11125
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11126
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11127
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11128
     && __isStringLike(aStringOrSymbol)) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11129
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11130
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11131
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11132
				  (create == true) ? False : True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11133
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11134
	if (prop == None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11135
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11136
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11137
	RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11138
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11139
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11140
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11141
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11142
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11143
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11144
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11145
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11146
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11147
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11148
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11149
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11150
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11151
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11152
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
 11153
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
 11154
    "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
 11155
     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
 11156
     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
 11157
     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
 11158
     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
 11159
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11160
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11161
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11162
    ((w <= 0) or:[h <= 0]) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11163
	self primitiveFailed.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11164
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11165
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11166
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11167
    rawInfo := Array new:8.
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11168
		  "1 -> bit order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11169
		  "2 -> depth"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11170
		  "3 -> bytes_per_line"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11171
		  "4 -> byte_order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11172
		  "5 -> format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11173
		  "6 -> bitmap_unit"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11174
		  "7 -> bitmap_pad"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11175
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11176
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11177
    "/ 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
 11178
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11179
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11180
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11181
    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11182
	info := IdentityDictionary new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11183
	info at:#bitOrder put:(rawInfo at:1).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11184
	info at:#depth put:(rawInfo at:2).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11185
	info at:#bytesPerLine put:(rawInfo at:3).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11186
	info at:#byteOrder put:(rawInfo at:4).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11187
	info at:#format put:(rawInfo at:5).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11188
	info at:#bitmapUnit put:(rawInfo at:6).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11189
	info at:#bitmapPad put:(rawInfo at:7).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11190
	info at:#bitsPerPixel put:(rawInfo at:8).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11191
	^ info
7506
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11192
    ].
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11193
    "
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11194
     some error occurred - either args are not smallintegers, imageBits is not a ByteArray
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11195
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11196
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11197
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11198
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11199
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11200
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
 11201
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
 11202
    "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
 11203
     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
 11204
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11205
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11206
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11207
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11208
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11209
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11210
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11211
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11212
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11213
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11214
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11215
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11216
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11217
	xpos = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11218
	ypos = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11219
	if ((xpos < 0) || (ypos < 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11220
	    RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11221
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11222
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11223
	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11224
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11225
	if (img != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11226
	    ret = XGetPixel(img, 0, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11227
	    XDestroyImage(img);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11228
	    RETURN (  __MKSMALLINT(ret) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11229
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11230
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11231
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11232
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11233
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11234
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11235
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
 11236
    "since XGetImage may allocate huge amount of stack space
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11237
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11238
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11239
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11240
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11241
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11242
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11243
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11244
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11245
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11246
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11247
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11248
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11249
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11250
     && __bothSmallInteger(w, h)
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11251
     && __isArray(info) && (__arraySize(info) >= 8)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11252
     && __isByteArray(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11253
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11254
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11255
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11256
	ENTER_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11257
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11258
				    __intVal(w), __intVal(h),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11259
				    (unsigned)AllPlanes, ZPixmap);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11260
	LEAVE_XLIB();
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11261
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11262
	if (! image) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11263
	    RETURN ( false );
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11264
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11265
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11266
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11267
#ifdef SUPERDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11268
	console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11269
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11270
	switch (image->depth) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11271
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11272
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11273
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11274
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11275
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11276
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11277
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11278
		numBytes = image->bytes_per_line * image->height;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11279
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11280
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11281
	    default:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11282
		/* unsupported depth ? */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11283
		console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11284
		numBytes = image->bytes_per_line * image->height;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11285
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11286
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11287
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11288
#ifdef SUPERDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11289
	console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11290
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11291
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11292
	if (numBytes > __byteArraySize(imageBits)) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11293
	    /* imageBits too small */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11294
	    console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11295
	    console_fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11296
	    console_fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n",
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11297
				image->bitmap_pad, image->depth, image->bytes_per_line);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11298
	    goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11299
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11300
	if (image->bitmap_bit_order == MSBFirst)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11301
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11302
	else
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11303
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11304
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11305
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11306
	if (image->byte_order == MSBFirst)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11307
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11308
	else
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11309
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11310
	if (image->format == XYBitmap)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11311
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11312
	else if (image->format == XYPixmap)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11313
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11314
	else if (image->format == ZPixmap)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11315
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11316
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11317
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11318
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11319
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11320
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11321
	XDestroyImage(image);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11322
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11323
    }
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11324
fail:
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11325
    if (image) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 11326
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11327
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11328
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11329
    ^ false
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11330
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11331
    "Modified: / 11-04-2017 / 21:17:31 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11332
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11333
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11334
!XWorkstation methodsFor:'selection fetching'!
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 11335
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11336
getClipboardObjectFor:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11337
    "get the object selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11338
     Returns nil, if no selection is available.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11339
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11340
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11341
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11342
    |selectionOwnerWindowId selection|
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11343
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11344
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11345
    selectionOwnerWindowId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11346
	"no selection. There is the possibilty that one of our (modal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11347
	 views has been closed. Get the selection from the copyBuffer"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11348
	^ copyBuffer.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11349
    ].
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 11350
    selectionOwnerWindowId = selectionOwner ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11351
	"I still hold the selection, so return my locally buffered data"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11352
	^ 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
 11353
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11354
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11355
    drawableId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11356
	"sorry, cannot fetch a selection, if there is no drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11357
	 Should I borrow a drawableId from another window?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11358
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11359
	selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11360
	    requestSelection:clipboardAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11361
	    type:(self atomIDOf:#'ST_OBJECT')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11362
	    onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11363
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11364
	"/ should not happen
6064
1cc8b8daaff5 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
 11365
false ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11366
	"/ cg: disabled the code below: I don't want any string here (when asking for an object)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11367
	selection isEmptyOrNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11368
	    selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11369
		requestSelection:clipboardAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11370
		type:(self atomIDOf:#'UTF8_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11371
		onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11372
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11373
	    selection isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11374
		selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11375
		    requestSelection:clipboardAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11376
		    type:(self atomIDOf:#STRING)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11377
		    onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11378
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11379
	].
6064
1cc8b8daaff5 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
 11380
].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11381
    ].
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
 11382
    selection isEmptyOrNil ifTrue:[ ^ copyBuffer ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11383
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11384
    ^ selection.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11385
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11386
    "
5928
a06ebbe0d07a comment/format in: #getClipboardObjectFor:
Stefan Vogel <sv@exept.de>
parents: 5914
diff changeset
 11387
       Display getClipboardObjectFor:Transcript id
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11388
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11389
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11390
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11391
getClipboardText:selectionBufferSymbol for:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11392
    "get the text selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11393
     Returns nil, if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11394
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11395
    |selectionId selectionOwnerWindowId selection|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11396
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11397
    selectionBufferSymbol == #selection ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11398
	selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11399
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11400
	selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11401
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11402
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11403
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11404
    selectionOwnerWindowId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11405
	"no selection. There is the possibilty that one of our (modal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11406
	 views has been closed. Get the selection from the copyBuffer"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11407
	^ self copyBufferAsString.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11408
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11409
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 11410
    selectionOwnerWindowId = selectionOwner ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11411
	"I still hold the selection, so return my locally buffered data"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11412
	"JV@2012-04-02: Added support for PRIMARY/SELECTION buffers."
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11413
	^ selectionId == primaryAtom ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11414
	    self primaryBufferAsString
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11415
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11416
	    self copyBufferAsString.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11417
	]
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
 11418
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11419
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11420
    drawableId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11421
	"sorry, cannot fetch a selection, if there is no drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11422
	 Should I borrow a drawableId from another window?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11423
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11424
	selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11425
	    requestSelection:selectionId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11426
	    type:(self atomIDOf:#'UTF8_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11427
	    onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11428
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11429
	selection isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11430
	    selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11431
		requestSelection:selectionId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11432
		type:(self atomIDOf:#STRING)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11433
		onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11434
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11435
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11436
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11437
    ^ selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11438
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11439
     "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11440
       Display getTextSelection:#clipboard for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11441
       Display getTextSelection:#selection for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11442
     "
5899
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11443
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11444
    "Modified: / 02-04-2012 / 10:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11445
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11446
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11447
!XWorkstation methodsFor:'selection sending'!
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11448
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11449
selectionBuffer:bufferGetSelector as:aTargetAtomID
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11450
    "convert the current selection to the format defined by aTargetAtom.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11451
     Answer an association with the type of converted selection (an atomID)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11452
     and the converted selection"
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11453
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11454
    |buffer bufferAsString|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11455
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11456
    buffer := self perform:bufferGetSelector.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11457
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11458
    (aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11459
	"/ 'st-object' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11460
	"send the selection in binaryStore format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11461
	"require libboss to be loaded"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11462
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11463
	    Logger error:'cannot use binary store for copy buffer (libboss missing)'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11464
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11465
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11466
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11467
	[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11468
	    ^ aTargetAtomID -> (buffer binaryStoreBytes).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11469
	] on:Error do:[:ex|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11470
	    Logger info:'error on binary store of copy buffer: %1' with: ex description.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11471
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11472
	].
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11473
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11474
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11475
    bufferAsString := self class bufferAsString:buffer.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11476
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11477
    (aTargetAtomID == (self atomIDOf:#STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11478
     or:[aTargetAtomID == (self atomIDOf:#'text/plain')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11479
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11480
	"/ 'string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11481
	"the other view wants the selection as string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11482
	^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11483
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11484
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11485
    (aTargetAtomID == (self atomIDOf:#UTF8_STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11486
     or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11487
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11488
	"/ 'utf string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11489
	"the other view wants the selection as utf8 string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11490
	^ aTargetAtomID -> (bufferAsString utf8Encoded).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11491
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11492
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11493
    aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11494
	"the other one wants to know the size of our selection.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11495
	 LENGTH is deprecated, since we do not know how the selection is
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11496
	 going to be converted. The client must not rely on the length returned"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11497
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11498
	^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11499
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11500
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11501
    "we do not support the requestet target type"
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11502
    ^ nil -> nil.
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11503
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11504
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11505
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11506
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11507
setClipboardObject:anObject owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11508
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11509
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11510
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11511
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11512
    clipboardSelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11513
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11514
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11515
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11516
setClipboardText:aString owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11517
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11518
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11519
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11520
     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
 11521
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11522
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11523
    clipboardSelectionTime := primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11524
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11525
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11526
    self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11527
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11528
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11529
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11530
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11531
setPrimaryText:aString owner:aWindowId
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11532
    "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
 11533
     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
 11534
     pasting. X Window specific."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11535
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11536
    primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11537
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11538
    self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11539
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11540
    "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
 11541
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11542
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11543
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11544
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11545
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11546
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 11547
    "Note: some sender code assumes that ST_OBJECT is first"
8225
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11548
    ^ #(
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11549
        ST_OBJECT 
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11550
        STRING 
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11551
        UTF8_STRING 
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11552
        TIMESTAMP 
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11553
        TARGETS 
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11554
        LENGTH
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11555
        #'text/plain' 
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11556
        #'text/plain;codeset=utf-8'
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11557
    ) collect:[:eachTargetSymbol| self atomIDOf:eachTargetSymbol] as:IntegerArray.
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11558
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11559
    "Modified (format): / 24-11-2017 / 11:06:23 / cg"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11560
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11561
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11562
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11563
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11564
getSelectionOwnerOf:selectionAtomSymbolOrID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11565
    "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
 11566
     Answer nil, if there is no owner"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11567
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11568
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11569
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11570
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11571
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11572
    selectionAtomSymbolOrID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11573
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11574
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11575
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11576
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11577
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11578
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11579
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11580
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11581
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11582
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11583
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11584
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11585
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11586
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11587
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11588
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11589
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11590
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11591
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11592
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11593
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11594
requestSelection:selectionID type:typeID for:aWindowId intoProperty:propertyID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11595
    "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
 11596
     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
 11597
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11598
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11599
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11600
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11601
    |anIntegerTimestamp|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11602
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11603
    anIntegerTimestamp := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11604
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11605
%{
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11606
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11607
    if (ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11608
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11609
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11610
     && __isAtomID(selectionID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11611
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11612
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11613
	Time time;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11614
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11615
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11616
	    w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11617
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11618
	    w = (Window)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11619
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11620
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11621
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11622
	if (anIntegerTimestamp == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11623
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11624
	     * the ICCCM convention says: you should set the time to the time when
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11625
	     * the selection was requested and not to CurrentTime
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11626
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11627
	    time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11628
	} else if (__isInteger(anIntegerTimestamp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11629
	    time = __unsignedLongIntVal(anIntegerTimestamp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11630
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11631
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11632
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11633
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11634
	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11635
			       __AtomVal(propertyID), w, time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11636
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11637
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11638
	RETURN (true);
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11639
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11640
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11641
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11642
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11643
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11644
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11645
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11646
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11647
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11648
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11649
	type:(Display atomIDOf:'STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11650
	for:Transcript id
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 11651
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 11652
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11653
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11654
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11655
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11656
	type:(Display atomIDOf:'C_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11657
	for:Transcript id
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11658
    "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11659
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11660
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 11661
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
 11662
    "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
 11663
     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
 11664
     could not be converted.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11665
     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
 11666
     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
 11667
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11668
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11669
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11670
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11671
	&& (__isAtomID(propertyID) || propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11672
	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11673
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11674
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11675
	Window requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11676
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11677
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11678
	if (__isExternalAddress(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11679
	    requestor = __WindowVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11680
	} else if (__isSmallInteger(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11681
	    requestor = (Window)__smallIntegerVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11682
	} else if (requestorID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11683
	    requestor = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11684
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11685
	    requestor = (Window)__unsignedLongIntVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11686
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11687
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11688
	ev.xselection.type = SelectionNotify;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11689
	ev.xselection.display = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11690
	ev.xselection.selection = __AtomVal(selectionID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11691
	ev.xselection.target = __AtomVal(targetID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11692
	ev.xselection.requestor = requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11693
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11694
	if (__isExternalAddress(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11695
	    ev.xselection.time = (INT)(__externalAddressVal(aTime));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11696
	} else if (__isSmallInteger(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11697
	    ev.xselection.time = __smallIntegerVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11698
	} else if (aTime == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11699
	    ev.xselection.time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11700
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11701
	    ev.xselection.time = (INT)__unsignedLongIntVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11702
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 11703
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11704
	console_printf("ev.xselection.selection: %x\n", ev.xselection.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11705
	console_printf("ev.xselection.target: %x\n", ev.xselection.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11706
	console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11707
	console_printf("ev.xselection.time: %x\n", ev.xselection.time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11708
	console_printf("requestor: %x\n", requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11709
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11710
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11711
	/* send nil property if selection cannot be converted */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11712
	if (propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11713
	    ev.xselection.property = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11714
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11715
	    ev.xselection.property = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11716
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11717
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11718
	DPRINTF(("sending SelectionNotify sel=%"_lx_" prop=%"_lx_" target=%"_lx_" requestor=%"_lx_" to %"_lx_"\n",
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11719
		(INT)ev.xselection.selection,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11720
		(INT)ev.xselection.property,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11721
		(INT)ev.xselection.target,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11722
		(INT)ev.xselection.requestor,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11723
		(INT)requestor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11724
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11725
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11726
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11727
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11728
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11729
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11730
	    DPRINTF(("bad status\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11731
	    RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11732
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11733
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11734
	XFlush(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11735
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11736
	RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11737
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11738
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11739
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 11740
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11741
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11742
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11743
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11744
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11745
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID time:anIntegerTimestamp
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11746
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11747
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11748
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11749
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11750
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11751
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11752
    "store the current owner of the selection.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11753
     If we still own the selection on paste,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11754
     we can avoid the X11 overhead"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11755
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11756
    selectionOwner := aWindowId.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11757
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11758
    selectionAtomSymbolOrID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11759
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11760
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11761
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11762
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11763
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11764
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11765
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11766
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11767
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11768
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11769
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11770
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11771
	Time time;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11772
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11773
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11774
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11775
	if (anIntegerTimestamp == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11776
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11777
	     * the ICCCM convention says: you should set the time to the time when
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11778
	     * the selection was acquired and not to CurrentTime
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11779
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11780
	    time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11781
	} else if (__isInteger(anIntegerTimestamp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11782
	    time = __unsignedLongIntVal(anIntegerTimestamp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11783
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11784
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11785
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11786
	DPRINTF(("setOwner prop=%"_lx_" win=%"_lx_"\n", (INT)__AtomVal(selectionAtomID), (INT)win));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11787
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11788
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11789
	RETURN (self);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11790
	LEAVE_XLIB();
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11791
    }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11792
err:;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11793
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11794
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11795
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11796
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11797
!XWorkstation methodsFor:'window queries'!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11798
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11799
allChildIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11800
    "return all children-ids of the given window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11801
     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
 11802
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11803
    |childIDs allChildIDs|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11804
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11805
    allChildIDs := OrderedCollection new.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11806
    childIDs := self childIdsOf:aWindowId.
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
 11807
    childIDs notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11808
	allChildIDs addAll:childIDs.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11809
	childIDs do:[:eachChildId |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11810
	    allChildIDs addAll:(self allChildIdsOf:eachChildId).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11811
	].
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11812
    ].
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11813
    ^ allChildIDs
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11814
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11815
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11816
     Display allChildIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11817
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11818
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11819
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11820
     |deviceIDAtom uuidAtom|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11821
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11822
     deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11823
     uuidAtom     := (Display atomIDOf:#'UUID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11824
     (Display allChildIdsOf:(Display rootWindowId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11825
	select:[:id |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11826
	    |uuid|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11827
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11828
	    Display
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11829
		getProperty:deviceIDAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11830
		from:id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11831
		delete:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11832
		into:[:type :value |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11833
		    type == uuidAtom ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11834
			uuid := UUID fromBytes:value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11835
		    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11836
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11837
	    uuid notNil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11838
	]
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11839
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11840
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11841
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11842
childIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11843
    "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
 11844
     enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11845
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11846
    |childIdArray|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11847
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11848
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11849
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11850
    if (ISCONNECTED
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11851
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11852
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11853
	Window win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11854
	Window rootReturn, parentReturn;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11855
	Window* children = (Window *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11856
	unsigned int numChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11857
	int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11858
	int rslt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11860
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11861
	rslt = XQueryTree(dpy, win,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11862
		       &rootReturn, &parentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11863
		       &children, &numChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11864
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11865
	if (rslt) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11866
	    childIdArray = __ARRAY_NEW_INT(numChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11867
	    if (childIdArray != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11868
		for (i=0; i < numChildren; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11869
		    if (children[i]) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11870
			OBJ childId;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11871
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11872
			childId = __MKEXTERNALADDRESS(children[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11873
			__ArrayInstPtr(childIdArray)->a_element[i] = childId;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11874
			__STORE(childIdArray, childId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11875
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11876
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11877
		if (children) XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11878
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11879
	    RETURN (childIdArray);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11880
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11881
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11882
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11883
    ^ nil.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11884
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11885
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11886
      Display childIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11887
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11888
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11889
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11890
realRootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11891
    "return the id of the real root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11892
     This may not be the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11893
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11894
     of it. Except for very special cases, use #rootWindowId, which takes
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11895
     care of any virtual root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11896
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11897
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11898
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11899
    Window root;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11900
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11901
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11902
    if (__INST(rootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11903
	RETURN (__INST(rootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11904
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11905
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11906
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11907
	root = RootWindow(myDpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11908
	if (! root) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11909
	    id = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11910
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11911
	    id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11912
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11913
	RETURN (id);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11914
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11915
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11916
    self primitiveFailedOrClosedConnection.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11917
    ^ nil
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11918
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11919
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11920
      Display rootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11921
      Display realRootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11922
    "
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11923
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11924
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11925
rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11926
    "return the id of the root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11927
     This is the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11928
     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
 11929
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11930
     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
 11931
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11932
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11933
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11934
    Window rootWin, vRootWin = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11935
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11936
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11937
    if (__INST(virtualRootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11938
	RETURN (__INST(virtualRootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11939
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11940
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11941
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11942
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11943
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11944
	rootWin = RootWindow(dpy, screen);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11945
#ifndef IRIS
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11946
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11947
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11948
	 * on IRIS, this creates a badwindow error - why ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11949
	 * children contains a funny window (000034)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11950
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11951
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11952
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11953
	 * care for virtual root windows (tvtwm & friends)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11954
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11955
	{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11956
	    Atom vRootAtom, kwinAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11957
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11958
	    Window rootReturn, parentReturn;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11959
	    Window* children = (Window *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11960
	    unsigned int numChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11961
	    int ignoreVRoot = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11962
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11963
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11964
	     * Take care of KDE 2.1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11965
	     * they define _SWM_ROOT but this is not the parent of
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11966
	     * the application windows.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11967
	     * Instead it is used for background painting
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11968
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11969
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11970
	    kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11971
	    if (kwinAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11972
		Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11973
		int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11974
		unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11975
		unsigned char *retVal = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11976
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11977
		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11978
				       0L, 1L, False, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11979
				       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11980
				       &nitems, &bytesafter, &retVal) == Success
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11981
			      && actual_type != 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11982
		if (retVal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11983
		    XFree(retVal);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11984
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11985
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11986
	    if (!ignoreVRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11987
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11988
		if (vRootAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11989
		    if (XQueryTree(dpy, rootWin,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11990
				       &rootReturn, &parentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11991
				       &children, &numChildren)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11992
			for (i=0; i < numChildren; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11993
			    Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11994
			    int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11995
			    unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11996
			    Window* newRoot = (Window*) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11997
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11998
			    if (children[i]) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11999
				if (XGetWindowProperty(dpy, children[i], vRootAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12000
						       0L, 1L, False, XA_WINDOW,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12001
						       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12002
						       &nitems, &bytesafter,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12003
						       (unsigned char**) &newRoot
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12004
						      ) == Success && newRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12005
				    vRootWin = *newRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12006
				    XFree(newRoot); /* XXX */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12007
				    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12008
				}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12009
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12010
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12011
			if (children) XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12012
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12013
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12014
	     }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12015
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12016
#endif
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12017
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12018
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12019
    if (! vRootWin) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12020
	vRootWin = rootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12021
	if (! vRootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12022
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12023
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12024
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12025
    id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12026
    id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12027
    RETURN ( id );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12028
%}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12029
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12030
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12031
      Display rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12032
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12033
! !
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12034
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12035
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12036
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12037
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12038
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12039
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12040
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12041
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12042
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12043
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12044
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12045
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12046
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12047
	 && __bothSmallInteger(x, y)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12048
	 && __bothSmallInteger(width, height)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12049
	    w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12050
	    h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12051
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12052
	     * need this check here: some servers simply dump core with bad args
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12053
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12054
	    if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12055
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12056
		XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12057
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12058
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12059
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12060
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12061
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12062
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12063
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12064
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12065
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12066
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12067
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12068
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12069
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12070
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12071
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12072
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12073
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12074
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12075
	    XClearWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12076
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12077
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12078
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12079
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12080
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12081
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12082
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12083
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12084
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12085
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12086
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12087
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12088
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12089
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12090
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12091
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12092
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12093
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12094
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12095
	 && __isExternalAddress(siblingId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12096
	    if (modeSymbol == @symbol(above)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12097
		chg.stack_mode = Above;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12098
	    } else if (modeSymbol == @symbol(below)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12099
		chg.stack_mode = Below;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12100
	    } else if (modeSymbol == @symbol(topIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12101
		chg.stack_mode = TopIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12102
	    } else if (modeSymbol == @symbol(bottomIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12103
		chg.stack_mode = BottomIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12104
	    } else if (modeSymbol == @symbol(opposite)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12105
		chg.stack_mode = Opposite;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12106
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12107
		mask = CWSibling;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12108
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12109
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12110
	    chg.sibling = __WindowVal(siblingId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12111
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12112
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12113
				    mask, &chg);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12114
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12115
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12116
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12117
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12118
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12119
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12120
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12121
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12122
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12123
getGeometryOf:aWindowId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12124
    "get a windows geometry.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12125
     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
 12126
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12127
     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
 12128
     relative to such a wrapper.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12129
     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
 12130
     (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
 12131
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12132
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12133
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12134
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12135
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12136
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12137
    int x_ret, y_ret;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12138
    unsigned int width_ret, height_ret,
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12139
		 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12140
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12141
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12142
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12143
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12144
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12145
	XGetGeometry(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12146
		     &root_ret,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12147
		     &x_ret, &y_ret,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12148
		     &width_ret, &height_ret, &border_width_ret,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12149
		     &depth_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12150
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12151
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12152
	x = __MKSMALLINT(x_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12153
	y = __MKSMALLINT(y_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12154
	width = __MKSMALLINT(width_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12155
	height = __MKSMALLINT(height_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12156
	depth = __MKSMALLINT(depth_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12157
	borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12158
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12159
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12160
    borderWidth isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12161
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12162
	^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12163
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12164
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12165
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12166
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12167
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12168
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12169
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12170
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12171
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12172
     Transcript topView device
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12173
	getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12174
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12175
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12176
     Transcript topView device
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12177
	getGeometryOf:(Transcript topView id)
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12178
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12179
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12180
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12181
	getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12182
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12183
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12184
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12185
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12186
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12187
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12188
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12189
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12190
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12191
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12192
    "return true, if the given window ID is (still) valid.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12193
     Especially useful, if the passed windowID is
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12194
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12195
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12196
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12197
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12198
%{
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12199
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12200
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12201
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12202
	char *name = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12203
	Status ok;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12204
	Window root, parent, *children = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12205
	unsigned int nChildren;
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12206
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12207
/*        ENTER_XLIB(); */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12208
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12209
			&root, &parent, &children, &nChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12210
	if (children) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12211
	    XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12212
	}
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12213
/*        LEAVE_XLIB();   */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12214
	if (ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12215
	    RETURN (true);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12216
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12217
	RETURN (false);
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12218
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12219
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12220
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12221
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12222
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12223
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12224
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12225
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12226
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12227
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12228
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12229
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12230
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12231
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12232
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12233
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12234
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12235
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12236
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12237
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12238
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12239
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12240
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12241
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12242
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12243
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12244
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12245
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12246
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12247
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12248
	XLowerWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12249
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12250
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12251
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12252
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12253
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12254
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12255
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12256
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12257
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12258
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12259
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12260
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12261
    "make a window visible - either as icon or as a real view
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12262
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12263
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12264
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12265
4480
3e1449309dfa Set icon mask in #mapWindow:....
Stefan Vogel <sv@exept.de>
parents: 4478
diff changeset
 12266
    |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12267
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12268
    aBoolean ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12269
	wicon := aView icon.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12270
	wicon notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12271
	    wiconId := wicon id.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12272
	    wicon mask notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12273
		iconMaskId := wicon mask id.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12274
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12275
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12276
	wiconView := aView iconView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12277
	wiconView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12278
	    wiconViewId := wiconView id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12279
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12280
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12281
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12282
    minExt notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12283
	minW := minExt x.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12284
	minH := minExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12285
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12286
    maxExt notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12287
	maxW := maxExt x.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12288
	maxH := maxExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12289
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12290
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12291
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12292
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12293
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12294
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12295
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12296
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12297
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12298
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12299
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12300
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12301
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12302
	szhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12303
	if (__bothSmallInteger(xPos, yPos)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12304
	    szhints.x = __intVal(xPos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12305
	    szhints.y = __intVal(yPos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12306
	    szhints.flags |= USPosition;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12307
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12308
	if (__bothSmallInteger(w, h)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12309
	    szhints.width = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12310
	    szhints.height = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12311
	    szhints.flags |= USSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12312
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12313
	if (__bothSmallInteger(minW, minH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12314
	    szhints.flags |= PMinSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12315
	    szhints.min_width = __intVal(minW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12316
	    szhints.min_height = __intVal(minH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12317
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12318
	if (__bothSmallInteger(maxW, maxH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12319
	    szhints.flags |= PMaxSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12320
	    szhints.max_width = __intVal(maxW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12321
	    szhints.max_height = __intVal(maxH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12322
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12323
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12324
	if (aBoolean == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12325
	    char *windowName = "";
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12326
	    Pixmap iconBitmap = (Pixmap)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12327
	    Pixmap iconMask = (Pixmap)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12328
	    Window iconWindow = (Window)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12329
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12330
	    if (__isExternalAddress(wiconId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12331
		iconBitmap = __PixmapVal(wiconId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12332
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12333
	    if (__isExternalAddress(iconMaskId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12334
		iconMask = __PixmapVal(iconMaskId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12335
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12336
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12337
	    if (__isExternalAddress(wiconViewId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12338
		iconWindow = __WindowVal(wiconViewId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12339
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12340
	    if (__isStringLike(wlabel))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12341
		windowName = (char *) __stringVal(wlabel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12342
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12343
	    if (iconBitmap || windowName) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12344
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12345
		XSetStandardProperties(dpy, win,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12346
					windowName, windowName,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12347
					iconBitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12348
					0, 0, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12349
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12350
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12351
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12352
	    wmhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12353
	    if (iconBitmap) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12354
		wmhints.flags |= IconPixmapHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12355
		wmhints.icon_pixmap = iconBitmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12356
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12357
	    if (iconMask) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12358
		wmhints.flags |= IconMaskHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12359
		wmhints.icon_mask = iconMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12360
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12361
	    if (iconWindow) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12362
		wmhints.flags |= IconWindowHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12363
		wmhints.icon_window = iconWindow;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12364
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12365
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12366
	    wmhints.initial_state = IconicState;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12367
	    wmhints.flags |= StateHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12368
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12369
	    XSetWMHints(dpy, win, &wmhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12370
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12371
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12372
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12373
	if (szhints.flags) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12374
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12375
	    XSetNormalHints(dpy, win, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12376
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12377
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12378
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12379
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12380
	XMapWindow(dpy, win);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12381
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12382
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12383
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12384
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12385
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12386
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12387
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12388
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12389
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12390
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12391
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12392
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12393
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12394
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12395
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12396
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12397
	XMapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12398
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12399
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12400
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12401
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12402
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12403
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12404
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12405
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12406
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12407
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12408
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12409
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12410
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12411
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12412
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12413
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12414
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12415
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12416
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12417
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12418
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12419
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12420
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12421
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12422
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12423
			      __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12424
			      newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12425
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12426
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12427
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12428
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12429
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12430
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12431
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12432
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12433
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12434
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12435
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12436
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12437
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12438
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12439
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12440
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12441
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12442
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12443
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12444
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12445
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12446
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12447
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12448
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12449
newGraphicsContextFor:aGraphicsMedium
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12450
    "Redefined to use my own device specific graphics context"
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12451
7486
c3a1433996ec #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7478
diff changeset
 12452
    ^ X11GraphicsContext onDevice:self.
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12453
!
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12454
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12455
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12456
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12457
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12458
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12459
%{
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12460
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12461
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12462
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12463
	Status ok;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12464
	Window root, parent, *children = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12465
	unsigned int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12466
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12467
/*        ENTER_XLIB(); */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12468
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12469
			&root, &parent, &children, &nChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12470
	if (children) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12471
	    XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12472
	}
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12473
/*        LEAVE_XLIB();   */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12474
	if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12475
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12476
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12477
	RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12478
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12479
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12480
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12481
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12482
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12483
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12484
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12485
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12486
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12487
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12488
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12489
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12490
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12491
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12492
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12493
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12494
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12495
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12496
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12497
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12498
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12499
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12500
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12501
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12502
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12503
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12504
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12505
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12506
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12507
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12508
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12509
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12510
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12511
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12512
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12513
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12514
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12515
     && __isExternalAddress(newParentWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12516
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12517
	Window _child, _newParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12518
	int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12519
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12520
	_child = __WindowVal(windowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12521
	_newParent = __WindowVal(newParentWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12522
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12523
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12524
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12525
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12526
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12527
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12528
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12529
	 * Code 'stolen' from xswallow source ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12530
	 * ... mhmh - what is this loop for ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12531
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12532
	for (i=0; i<5; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12533
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12534
	    XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12535
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12536
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12537
	XMapWindow (dpy, _child);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12538
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12539
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12540
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12541
	RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12542
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12543
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12544
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12545
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12546
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12547
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12548
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12549
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12550
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12551
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12552
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12553
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12554
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12555
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12556
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12557
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12558
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12559
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12560
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12561
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12562
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12563
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12564
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12565
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12566
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12567
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12568
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12569
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12570
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12571
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12572
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12573
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12574
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12575
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12576
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12577
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12578
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12579
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12580
	if (__INST(ignoreBackingStore) != true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12581
	    if (how == @symbol(always)) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12582
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12583
	    else if (how == true) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12584
	    else wa.backing_store = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12585
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12586
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12587
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12588
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12589
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12590
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12591
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12592
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12593
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12594
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12595
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12596
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12597
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12598
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12599
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12600
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12601
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12602
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12603
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12604
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12605
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12606
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12607
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12608
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12609
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12610
	    wa.bit_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12611
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12612
	    wa.bit_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12613
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12614
	    wa.bit_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12615
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12616
	    wa.bit_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12617
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12618
	    wa.bit_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12619
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12620
	    wa.bit_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12621
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12622
	    wa.bit_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12623
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12624
	    wa.bit_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12625
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12626
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12627
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12628
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12629
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12630
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12631
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12632
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12633
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12634
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12635
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12636
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12637
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12638
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12639
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12640
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12641
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12642
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12643
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12644
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12645
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12646
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12647
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12648
     && __isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12649
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12650
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12651
	Cursor c = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12652
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12653
	if (w && c) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12654
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12655
	    XDefineCursor(dpy, w, c);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12656
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12657
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12658
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12659
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12660
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12661
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12662
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12663
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12664
setForegroundWindow:aWindowId
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12665
    "bring a window to front.
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12666
     Send a specific message to the WindowManager"
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12667
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12668
    |activeWindowAtom|
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12669
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12670
"/    self raiseWindow:aWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12671
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12672
    activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12673
    activeWindowAtom notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12674
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12675
	    sendClientEvent:activeWindowAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12676
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12677
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12678
	    propagate:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12679
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12680
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12681
	    data1:2                 "activate request from pager. This is a trick: kwm ignores requests from applications (1)"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12682
	    data2:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12683
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12684
	    data4:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12685
	    data5:nil.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12686
    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12687
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12688
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12689
      Transcript topView setForegroundWindow
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12690
    "
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12691
!
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12692
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12693
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12694
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12695
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12696
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12697
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12698
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12699
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12700
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12701
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12702
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 12703
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12704
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12705
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12706
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12707
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12708
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12709
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12710
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12711
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12712
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12713
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12714
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12715
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12716
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12717
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12718
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12719
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12720
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12721
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12722
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12723
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12724
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12725
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12726
	XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12727
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12728
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12729
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12730
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12731
    self primitiveFailedOrClosedConnection
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12732
!
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12733
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12734
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12735
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12736
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12737
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12738
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12739
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12740
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12741
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12742
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12743
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12744
	if (__INST(hasSaveUnder) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12745
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12746
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12747
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12748
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12749
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12750
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12751
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12752
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12753
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12754
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12755
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12756
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12757
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12758
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12759
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12760
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12761
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12762
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12763
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12764
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12765
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12766
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12767
	    w = (Window) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12768
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12769
	    if (__isExternalAddress(aMainWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12770
		w = __WindowVal(aMainWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12771
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12772
		goto getOutOfHere;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12773
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12774
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12775
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12776
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12777
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12778
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12779
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 12780
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12781
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12782
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12783
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12784
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12785
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12786
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12787
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12788
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12789
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12790
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12791
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12792
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12793
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12794
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12795
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12796
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12797
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12798
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12799
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12800
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12801
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12802
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12803
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12804
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12805
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12806
    "set the windows background pattern to be a form.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12807
     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
 12808
     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
 12809
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12810
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12811
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
 12812
%{  /* STACK: 64000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12813
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12814
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12815
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12816
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12817
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12818
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12819
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12820
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12821
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12822
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12823
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12824
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12825
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12826
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12827
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12828
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12829
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12830
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12831
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12832
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12833
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12834
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12835
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12836
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12837
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12838
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12839
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12840
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12841
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12842
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12843
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12844
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12845
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12846
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12847
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12848
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12849
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12850
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12851
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12852
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12853
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12854
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12855
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12856
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12857
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12858
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12859
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12860
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12861
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12862
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12863
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12864
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12865
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12866
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12867
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12868
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12869
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12870
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12871
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12872
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12873
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12874
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12875
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12876
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12877
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12878
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12879
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12880
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12881
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12882
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12883
			  0, 0, shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12884
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12885
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12886
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12887
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12888
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12889
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12890
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12891
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12892
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12893
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12894
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12895
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12896
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12897
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12898
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12899
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12900
     && __isSmallInteger(aNumber)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12901
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12902
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12903
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12904
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12905
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12906
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12907
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12908
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12909
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12910
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
 12911
    "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
 12912
     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
 12913
     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
 12914
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12915
    <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
 12916
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12917
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12918
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12919
	XClassHint classhint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12920
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12921
	classhint.res_class = classhint.res_name = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12922
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12923
	if (__isStringLike(wClass)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12924
	    classhint.res_class = (char *) __stringVal(wClass);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12925
	} else if (wClass != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12926
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12927
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12928
	if (__isStringLike(wName)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12929
	    classhint.res_name = (char *) __stringVal(wName);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12930
	} else if (wName != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12931
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12932
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12933
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12934
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12935
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12936
	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
 12937
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 12938
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 12939
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12940
    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
 12941
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 12942
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12943
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12944
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12945
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12946
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12947
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12948
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12949
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12950
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12951
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12952
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12953
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12954
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12955
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12956
	    wa.win_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12957
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12958
	    wa.win_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12959
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12960
	    wa.win_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12961
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12962
	    wa.win_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12963
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12964
	    wa.win_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12965
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12966
	    wa.win_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12967
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12968
	    wa.win_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12969
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12970
	    wa.win_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12971
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12972
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12973
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12974
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12975
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12976
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12977
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12978
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12979
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12980
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12981
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12982
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12983
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12984
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12985
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12986
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12987
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12988
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12989
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12990
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12991
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12992
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12993
    aForm notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12994
	iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12995
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12996
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12997
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12998
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12999
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13000
	XWMHints hints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13001
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13002
	hints.icon_pixmap = __PixmapVal(iconId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13003
	hints.flags = IconPixmapHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13004
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13005
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13006
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13007
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13008
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13009
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13010
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13011
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13012
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13013
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13014
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13015
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13016
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13017
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13018
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13019
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13020
    aForm notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13021
	iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13022
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13023
    aMaskForm notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13024
	maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13025
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13026
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13027
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13028
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13029
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13030
	XWMHints hints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13031
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13032
	hints.icon_pixmap = __PixmapVal(iconId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13033
	hints.flags = IconPixmapHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13034
	if ((maskId != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13035
	 && __isExternalAddress(maskId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13036
	    hints.icon_mask = __PixmapVal(maskId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13037
	    hints.flags |= IconMaskHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13038
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13039
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13040
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13041
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13042
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13043
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13044
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13045
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13046
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13047
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13048
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13049
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13050
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13051
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13052
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13053
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13054
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13055
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13056
    aView notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13057
	iconWindowId := aView id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13058
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13059
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13060
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13061
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13062
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13063
	XWMHints wmhints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13064
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13065
	wmhints.icon_window = __WindowVal(iconWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13066
	wmhints.flags = IconWindowHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13067
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13068
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13069
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13070
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13071
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13072
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13073
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13074
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13075
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 13076
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
 13077
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13078
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13079
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13080
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13081
%{
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13082
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13083
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13084
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13085
	XSizeHints szhints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13086
	Window win;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13087
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13088
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13089
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13090
	szhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13091
	if (__bothSmallInteger(minW, minH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13092
	    szhints.flags |= PMinSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13093
	    szhints.min_width = __intVal(minW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13094
	    szhints.min_height = __intVal(minH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13095
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13096
	if (__bothSmallInteger(maxW, maxH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13097
	    szhints.flags |= PMaxSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13098
	    szhints.max_width = __intVal(maxW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13099
	    szhints.max_height = __intVal(maxH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13100
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13101
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13102
	if (szhints.flags) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13103
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13104
	    XSetNormalHints(dpy, win, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13105
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13106
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13107
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13108
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13109
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13110
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13111
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13112
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13113
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13114
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13115
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13116
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13117
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13118
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13119
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13120
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 13121
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13122
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13123
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 13124
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13125
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13126
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13127
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13128
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13129
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13130
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13131
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13132
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13133
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13134
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13135
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13136
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13137
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13138
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13139
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13140
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13141
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13142
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13143
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13144
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13145
	XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13146
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13147
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13148
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13149
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13150
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13151
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13152
5974
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13153
setWindowPid:anIntegerOrNil in:aWindowId
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13154
    "Sets the _NET_WM_PID property for the window.
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13155
     This may be used by the window manager to group windows.
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13156
     If anIntegerOrNil is nil, then PID of currently running
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13157
     Smalltalk is used"
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13158
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13159
    | propertyID typeId pid |
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13160
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13161
    propertyID := self atomIDOf: '_NET_WM_PID' create: false.
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13162
    propertyID isNil ifTrue:[ ^ self ].
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13163
    pid := anIntegerOrNil isNil ifTrue:[OperatingSystem getProcessId] ifFalse:[anIntegerOrNil].
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13164
    typeId := self atomIDOf:#'CARDINAL' create:false.
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13165
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13166
    self setProperty:propertyID type:typeId value:pid for:aWindowId
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13167
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13168
    "Created: / 04-01-2013 / 16:03:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13169
!
b3499f80b70c ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5972
diff changeset
 13170
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13171
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13172
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13173
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13174
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13175
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13176
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13177
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13178
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13179
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13180
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13181
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13182
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13183
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13184
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13185
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13186
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13187
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13188
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13189
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13190
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13191
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13192
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13193
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13194
			  0, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13195
			  shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13196
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13197
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13198
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13199
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13200
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13201
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13202
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13203
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13204
setWindowState:aSymbol in:aWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13205
    "tell the window type to the window manager.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13206
     Send a specific message to the WindowManager"
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13207
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13208
    |netWmWindowStateAtom stateAtom|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13209
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13210
    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
 13211
    stateAtom := self atomIDOf:aSymbol create:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13212
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13213
    (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13214
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13215
	    sendClientEvent:netWmWindowStateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13216
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13217
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13218
	    propagate:true
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13219
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13220
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13221
	    data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13222
	    data2:stateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13223
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13224
	    data4:1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13225
	    data5:nil.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13226
    ] ifFalse:[self halt.].
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13227
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13228
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13229
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13230
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13231
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13232
      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
 13233
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13234
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13235
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13236
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13237
setWindowType:aSymbol in:aWindowId
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13238
    "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
 13239
     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
 13240
     chapter 'Application Window Properties'
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13241
     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
 13242
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13243
    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
 13244
    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
 13245
    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
 13246
    EWMH compatible, as this improve UX on modern Linxu
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13247
    machines.
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13248
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13249
    It also helps to fix super-annoying problem with window autoraiser
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13250
    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
 13251
    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
 13252
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13253
    "
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13254
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13255
    | nameAtom typeAtom valueAtom |
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13256
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13257
    self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13258
		  _NET_WM_WINDOW_TYPE_DOCK
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13259
		  _NET_WM_WINDOW_TYPE_TOOLBAR
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13260
		  _NET_WM_WINDOW_TYPE_MENU
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13261
		  _NET_WM_WINDOW_TYPE_UTILITY
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13262
		  _NET_WM_WINDOW_TYPE_SPLASH
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13263
		  _NET_WM_WINDOW_TYPE_DIALOG
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13264
		  _NET_WM_WINDOW_TYPE_NORMAL) includes: aSymbol).
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13265
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13266
    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
 13267
    nameAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13268
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13269
	self breakPoint: #jv.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13270
	^self
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13271
    ].
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13272
    "/ Hmm, hmm, no access to XA_ATOM, XA_INTEGER and so on...
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13273
    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
 13274
    typeAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13275
	self error:'Oops, no ATOM atom'.
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13276
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13277
    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
 13278
    valueAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13279
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13280
	self breakPoint: #jv.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13281
	^self
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13282
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13283
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13284
    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
 13285
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13286
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13287
"/   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
 13288
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13289
"/    |netWmWindowTypeAtom typeAtom|
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13290
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13291
"/    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
 13292
"/    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
 13293
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13294
"/    (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
 13295
"/        self
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13296
"/            sendClientEvent:netWmWindowTypeAtom
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13297
"/            format:32
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13298
"/            to:(self rootWindowId)
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13299
"/            propagate:true
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13300
"/            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
 13301
"/            window:aWindowId
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13302
"/            data1:typeAtom
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13303
"/            data2:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13304
"/            data3:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13305
"/            data4:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13306
"/            data5:nil.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13307
"/    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13308
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13309
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13310
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13311
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13312
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13313
      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
 13314
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13315
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13316
      |v|
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13317
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13318
      v := TopView new create.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13319
      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
 13320
      v open.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13321
    "
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13322
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13323
    "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
 13324
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13325
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13326
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13327
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13328
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13329
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13330
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13331
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13332
     * 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
 13333
     */
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13334
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13335
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13336
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13337
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13338
    if (__isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13339
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13340
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13341
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13342
	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
 13343
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13344
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13345
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13346
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13347
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13348
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13349
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13350
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13351
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13352
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13353
%{
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13354
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13355
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13356
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13357
	Atom JunkAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13358
	int JunkInt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13359
	unsigned long WinState,JunkLong;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13360
	unsigned char *Property;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13361
	Atom WM_STATE_Atom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13362
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13363
	if (__INST(wmStateAtom) != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13364
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13365
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13366
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13367
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13368
			       WM_STATE_Atom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13369
			       0L, 2L, False, AnyPropertyType,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13370
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13371
			       &Property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13372
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13373
	    WinState=(unsigned long)(*((long*)Property));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13374
	    if (WinState==3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13375
		RETURN (true);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13376
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13377
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13378
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13379
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13380
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13381
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13382
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13383
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13384
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13385
!XWorkstation::PseudoDeviceWithoutXFTSupport class methodsFor:'documentation'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13386
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13387
documentation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13388
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13389
    this is a proxy device, which forwards its messages to a real device,
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13390
    possibly overriding some messages.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13391
    It is currently only used as a hack (workaround) a bug in the XWindows
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13392
    interface, which cannot draw strings into pixmaps using XFT fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13393
    For this, a pseudoDevice instance is set as device into the pixmap's GC,
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13394
    so it will draw using non-xft fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13395
    This should vanish, once the xft drawing works.
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13396
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13397
    [author:]
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13398
	cg
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13399
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13400
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13401
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13402
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'accessing'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13403
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13404
realDevice:aDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13405
    realDevice := aDevice.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13406
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13407
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13408
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'message forwarding'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13409
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13410
doesNotUnderstand:aMessage
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13411
    ^ aMessage sendTo:realDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13412
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13413
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13414
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'queries'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13415
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13416
deviceFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13417
    ^ realDevice deviceFonts keys reject:[:f | f isXftFont ]
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13418
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13419
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13420
supportsXftFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13421
    ^ false.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13422
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13423
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13424
!XWorkstation::SelectionFetcher class methodsFor:'documentation'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13425
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13426
documentation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13427
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13428
    This class is responsible for fetching the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13429
    The X11 clipboard is implemented via asynchonous messages.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13430
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13431
    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
 13432
    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
 13433
    process that requests the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13434
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13435
    [author:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13436
	Stefan Vogel (stefan@zwerg)
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13437
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13438
    [instance variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13439
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13440
    [class variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13441
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13442
    [see also:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13443
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13444
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13445
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13446
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13447
!XWorkstation::SelectionFetcher class methodsFor:'selections'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13448
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13449
requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13450
    ^ 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
 13451
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13452
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13453
!XWorkstation::SelectionFetcher methodsFor:'accessing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13454
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13455
drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13456
    ^ drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13457
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13458
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13459
getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13460
    "convert the data in buffer to a selection"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13461
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13462
    |selection|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13463
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13464
    buffer isNil ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13465
        ^ nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13466
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13467
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13468
    targetID == (display atomIDOf:#STRING) ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13469
        display clipboardEncoding notNil ifTrue:[
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13470
            selection := buffer decodeFrom:display clipboardEncoding
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13471
        ].
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13472
        selection := buffer.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13473
    ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13474
        "/ Transcript show:'UTF8: '; showCR:buffer storeString.
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13475
        selection := buffer utf8Decoded.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13476
    ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13477
        "/ Transcript show:'TEXT: '; showCR:buffer storeString.
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13478
        selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13479
    ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13480
        "/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13481
        selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13482
    ]]]].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13483
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13484
    selection notNil ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13485
        (selection endsWith:Character cr) ifTrue:[
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13486
            selection := selection asStringCollection copyWith:''
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13487
        ].
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13488
        ^ selection.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13489
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13490
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13491
    targetID == (display atomIDOf:#'TARGETS') ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13492
        ^ buffer
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13493
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13494
    targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13495
        "require libboss to be loaded"
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13496
        (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13497
            'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR.
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13498
            ^ nil
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13499
        ].
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13500
        ^ (Object
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13501
            readBinaryFrom:(ReadStream on:buffer)
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13502
            onError:[:ex |
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13503
                ('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR.
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13504
                nil
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13505
            ])
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13506
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13507
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13508
    '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
 13509
    ' buffer:' infoPrint. buffer infoPrintCR.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13510
    ^ nil
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13511
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13512
    "Modified: / 23-08-2006 / 15:56:04 / cg"
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13513
    "Modified (format): / 08-10-2017 / 08:45:59 / cg"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13514
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13515
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13516
!XWorkstation::SelectionFetcher methodsFor:'event handling'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13517
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13518
message:aMessage
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13519
    "got an asynchronous event from the display.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13520
     Save and wake up waiters"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13521
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13522
    aMessage selector == #propertyChange:property:state:time: ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13523
	(aMessage arguments at:2) ~~ propertyID ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13524
	    "I am only interested in changes of the property used to
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13525
	     store the selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13526
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13527
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13528
	message notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13529
	    "this should not happen - bad selection holder?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13530
	    'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13531
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13532
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13533
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13534
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13535
    "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
 13536
     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
 13537
     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
 13538
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13539
    message := aMessage.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13540
    sema signal.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13541
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13542
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13543
propertyChange:aView property:aPropertyId state:stateSymbol time:time
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13544
    "this is a forwarded propretyChange event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13545
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13546
    |property propertyValue|
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13547
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13548
    incremental ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13549
	"ignore property changes until we are in incremental mode"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13550
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13551
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13552
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13553
    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
 13554
    propertyValue := property value.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13555
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13556
    propertyValue size == 0 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13557
	"property with size 0 signals end of transfer"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13558
	done := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13559
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13560
	buffer isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13561
	    targetID := property key.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13562
	    buffer := propertyValue.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13563
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13564
	    targetID ~= property key ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13565
		'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13566
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13567
	    buffer := buffer, propertyValue.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13568
	].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13569
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13570
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13571
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13572
selectionClear:aView selection:selectionId time:time
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13573
    "sent when another X-client has created a selection.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13574
     This is a very X-specific mechanism."
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13575
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13576
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13577
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
 13578
    "this is a forwarded selectionNotify event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13579
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13580
    |property propertyKey atomName|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13581
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13582
    aSelectionID ~~ selectionID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13583
	"ignore notification that is not for our selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13584
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13585
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13586
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13587
    aPropertyID == 0 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13588
	"the selection owner could not convert the selection to our target type"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13589
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13590
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13591
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13592
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13593
    property := display getProperty:aPropertyID from:drawableID delete:true.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13594
    property isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13595
	"the property does not exist in the specified window"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13596
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13597
	^ self
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13598
    ].
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13599
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13600
    propertyKey := property key.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13601
    propertyKey == aTargetID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13602
	"good, the property is consistent with our request.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13603
	 The whole selection is in the property"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13604
	buffer := property value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13605
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13606
    ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13607
	"this is an incremental transfer. Wait for property change"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13608
	incremental := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13609
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13610
	atomName := (display atomName:propertyKey) ? propertyKey.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13611
	'XWorkstation(error): unexpected targetID (' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13612
	atomName errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13613
	') in selectionNotify: ' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13614
	display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13615
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13616
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13617
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13618
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13619
!XWorkstation::SelectionFetcher methodsFor:'selection actions'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13620
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13621
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
 13622
    "request the selection of type targetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13623
     Wait for next asynchronous message and process it,
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13624
     until done"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13625
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13626
    display := aDisplay.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13627
    drawableID := aDrawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13628
    selectionID := aSelectionId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13629
    propertyID := display atomIDOf:#'VT_SELECTION'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13630
    targetID := aTargetId.
8070
26577d2836ff #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 8062
diff changeset
 13631
    sema := Semaphore name:'X11SelectionFetcher'.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13632
    done := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13633
    incremental := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13634
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13635
    [
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13636
	|timeout|
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13637
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13638
	display registerSelectionFetcher:self.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13639
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13640
	display
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13641
	    requestSelection:aSelectionId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13642
	    type:aTargetId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13643
	    for:drawableID
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13644
	    intoProperty:propertyID.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13645
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13646
	timeout := display xlibTimeout.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13647
	[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13648
	    |currentMessage|
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13649
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13650
	    (sema waitWithTimeout:timeout) isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13651
		"the selection owner didn't respond within reasonable time"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13652
		'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13653
		^ nil.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13654
	    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13655
	    currentMessage := message.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13656
	    message := nil.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13657
	    currentMessage notNil ifTrue:[currentMessage sendTo:self].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13658
	] doUntil:[done].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13659
    ] ensure:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13660
	display unregisterSelectionFetcher:self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13661
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13662
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13663
    ^ self getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13664
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13665
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13666
!XWorkstation::SelectionFetcher methodsFor:'testing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13667
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13668
matchesDrawableId:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13669
    "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
 13670
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13671
    ^ drawableID = aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13672
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13673
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13674
!XWorkstation::WindowGroupWindow class methodsFor:'documentation'!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13675
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13676
documentation
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13677
"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13678
    A special window to serve as window group id. This window
6291
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13679
    is newer mapped. This window is used
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13680
    in XWMHints & _NET_WM_LEADER properties to define
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13681
    application window group
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13682
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13683
    [author:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13684
	Jan Vrany <jan.vrany@fit.cvut.cz>
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13685
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13686
    [instance variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13687
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13688
    [class variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13689
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13690
    [see also:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13691
	Inter-Client Communication Conventions Manual [http://tronche.com/gui/x/icccm/]
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13692
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13693
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13694
"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13695
! !
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13696
6291
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13697
!XWorkstation::WindowGroupWindow methodsFor:'testing'!
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13698
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13699
isICCCWindowGroupWindow
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13700
    ^ true
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13701
! !
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13702
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13703
!XWorkstation::X11GraphicsContext methodsFor:'accessing'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13704
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13705
depth
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13706
    ^ depth
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13707
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13708
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13709
xftDrawId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13710
    ^ xftDrawId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13711
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13712
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13713
!XWorkstation::X11GraphicsContext methodsFor:'destroying'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13714
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13715
destroy
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13716
    xftDrawId notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13717
	self destroyXftDrawId.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13718
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13719
    super destroy.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13720
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13721
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13722
destroyXftDrawId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13723
    |id|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13724
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13725
    id := xftDrawId.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13726
    xftDrawId := nil.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13727
%{
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13728
#ifdef XFT
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13729
    if (__isExternalAddress(id)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13730
	XftDraw *address = (XftDraw *)__externalAddressVal(id);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13731
	if (address) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13732
	    XftDrawDestroy(address);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13733
	    __externalAddressVal(id) = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13734
	}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13735
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13736
#endif
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13737
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13738
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13739
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13740
!XWorkstation::X11GraphicsContext methodsFor:'displaying'!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13741
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13742
displayDeviceString:aString from:index1 to:index2 x:x y:y opaque:opaque
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13743
    "draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13744
     foreground and background characters.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13745
     If the coordinates are not integers, an error is triggered."
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13746
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13747
    <context: #return>
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13748
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13749
    |displayId|
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13750
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13751
    font isXftFont ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13752
	self displayDeviceXftString:aString from:index1 to:index2 x:x y:y opaque:opaque.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13753
	^ self.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13754
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13755
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13756
    device flushIfAppropriate.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13757
    displayId := device displayIdOrErrorIfBroken.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13758
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13759
%{
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13760
    GC gc;
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13761
    Window win;
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13762
    char *cp;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13763
    int  i1, i2, l, n;
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13764
#   define NLOCALBUFFER 200
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13765
    XChar2b xlatebuffer[NLOCALBUFFER];
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13766
    int nInstBytes;
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13767
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13768
    if (__isExternalAddress(displayId)
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13769
     && __isExternalAddress(__INST(gcId))
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13770
     && __isExternalAddress(__INST(drawableId))
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13771
     && __isNonNilObject(aString)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13772
     && __bothSmallInteger(index1, index2)
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13773
     && __bothSmallInteger(x, y)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13774
	int lMax = __intVal(@global(XWorkstation:MaxStringLength));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13775
	Display *dpy = __DisplayVal(displayId);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13776
	gc = __GCVal(__INST(gcId));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13777
	win = __WindowVal(__INST(drawableId));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13778
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13779
	i1 = __intVal(index1) - 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13780
	if (i1 >= 0) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13781
	    OBJ cls;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13782
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13783
	    i2 = __intVal(index2) - 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13784
	    if (i2 < i1) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13785
		RETURN (self);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13786
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13787
	    cp = (char *) __stringVal(aString);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13788
	    l = i2 - i1 + 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13789
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13790
	    if (__isStringLike(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13791
		n = __stringSize(aString);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13792
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13793
		    cp += i1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13794
		    if (l > lMax) l = lMax;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13795
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13796
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13797
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13798
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13799
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13800
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13801
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13802
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13803
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13804
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13805
	    cls = __qClass(aString);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13806
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13807
	    cp += nInstBytes;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13808
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13809
	    if (__isBytes(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13810
		n = __byteArraySize(aString) - nInstBytes - 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13811
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13812
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13813
		    cp += i1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13814
		    if (l > lMax) l = lMax;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13815
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13816
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13817
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13818
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13819
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13820
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13821
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13822
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13823
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13824
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13825
	    /* TWOBYTESTRINGS */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13826
	    if (__isWords(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13827
		n = (__byteArraySize(aString) - nInstBytes) / 2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13828
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13829
		    union {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13830
			char b[2];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13831
			unsigned short s;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13832
		    } u;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13833
		    int i;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13834
		    XChar2b *cp2 = (XChar2b *)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13835
		    int mustFree = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13836
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13837
		    cp += (i1 * 2);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13838
		    if (l > lMax) l = lMax;
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13839
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13840
#if defined(MSBFIRST) || defined(__MSBFIRST)
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13841
		    /*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13842
		     * chars already in correct order
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13843
		     */
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13844
#else
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13845
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13846
		    /*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13847
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13848
		     * X expects them MSB first
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13849
		     * convert as required
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13850
		     */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13851
		    u.s = 0x1234;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13852
		    if (u.b[0] != 0x12)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13853
# endif  // ! (defined(LSBFIRST) || defined(__LSBFIRST))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13854
		    {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13855
			if (l <= NLOCALBUFFER) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13856
			    cp2 = xlatebuffer;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13857
			} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13858
			    cp2 = (XChar2b *)(malloc(l * 2));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13859
			    mustFree = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13860
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13861
			for (i=0; i<l; i++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13862
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13863
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13864
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13865
			cp = (char *) cp2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13866
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13867
#endif  // ! (defined(MSBFIRST) || defined(__MSBFIRST))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13868
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13869
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13870
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13871
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13872
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13873
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13874
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13875
		    if (mustFree) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13876
			free(cp2);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13877
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13878
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13879
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13880
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13881
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13882
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13883
	    /* FOURBYTESTRINGS */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13884
	    if (__isLongs(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13885
		n = (__byteArraySize(aString) - nInstBytes) / 4;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13886
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13887
		    union {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13888
			char b[2];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13889
			unsigned short s;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13890
		    } u;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13891
		    int i;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13892
		    XChar2b *cp2 = (XChar2b *)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13893
		    int32 *ip;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13894
		    int mustFree = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13895
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13896
		    cp += (i1 * 4);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13897
		    if (l > lMax) l = lMax;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13898
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13899
		    /*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13900
		     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13901
		     */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13902
		    if (l <= NLOCALBUFFER) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13903
			cp2 = xlatebuffer;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13904
		    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13905
			cp2 = (XChar2b *)(malloc(l * 2));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13906
			mustFree = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13907
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13908
		    for (i=0; i<l; i++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13909
			int32 codePoint = ((int32 *)cp)[i];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13910
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13911
			if (codePoint > 0xFFFF) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13912
			    codePoint = 0xFFFF;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13913
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13914
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13915
			cp2[i].byte2 = codePoint & 0xFF;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13916
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13917
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13918
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13919
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13920
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13921
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13922
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13923
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13924
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13925
		    if (mustFree) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13926
			free(cp2);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13927
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13928
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13929
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13930
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13931
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13932
	}
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13933
    }
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13934
#undef NLOCALBUFFER
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13935
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13936
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13937
    "x/y not integer, badGC or drawable, or not a string"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13938
    device primitiveFailedOrClosedConnection
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13939
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13940
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13941
displayDeviceXftString:aString from:index1 to:index2Arg x:drawX y:drawY opaque:opaque
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13942
    "draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13943
     foreground and background characters.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13944
     If the coordinates are not integers, an error is triggered."
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13945
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13946
    <context: #return>
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13947
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13948
    |index2 bytesPerCharacter
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13949
     clipX clipY clipW clipH
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13950
     fgR fgG fgB fgA fgPixel bgR bgG bgB bgA bgPixel
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13951
     displayId screen error stringLen
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13952
     newXftDrawId pixmapDepth fontId|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13953
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13954
"/    device flushIfAppropriate.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13955
    displayId := device displayIdOrErrorIfBroken.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13956
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13957
    "limit the string len, otherwise bad output is generated"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13958
    stringLen := index2Arg - index1 + 1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13959
    stringLen > 1000 "8000" ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13960
	index2 := index1 + 1000 "8000" - 1.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13961
    ]  ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13962
	stringLen <= 0 ifTrue:[^ self].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13963
	index2 := index2Arg.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13964
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13965
    bytesPerCharacter := aString bytesPerCharacter.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13966
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13967
    clipRect notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13968
	clipX := clipRect left.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13969
	clipY := clipRect top.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13970
	clipW := clipRect width.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13971
	clipH := clipRect height.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13972
"/clipW > 32767 ifTrue:['clipW > 32767: ' errorPrint. clipW errorPrintCR. clipW := 32767].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13973
"/(clipX > 16384 or:[clipX < -16384]) ifTrue:['clipX > 16384: ' errorPrint. clipX errorPrintCR.].
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13974
	"/ YES YES YES: this MUST be transformed!!
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13975
	"/ (see htmlView) fix the notebook, please.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13976
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13977
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13978
    fgR := paint scaledRed.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13979
    fgR notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13980
	fgG := paint scaledGreen.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13981
	fgB := paint scaledBlue.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13982
	fgA := paint scaledAlpha.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13983
    ] ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13984
	"/ when drawing into a pixmap...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13985
	fgPixel := paint colorId.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13986
	fgPixel == 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13987
	    fgR := fgG := fgB := 0.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13988
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13989
	    fgR := fgG := fgB := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13990
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13991
	fgA := 16rFFFF.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13992
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13993
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13994
    opaque ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13995
	bgPaint isColor ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13996
	    bgR := bgPaint scaledRed.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13997
	    bgR notNil ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13998
		bgG := bgPaint scaledGreen.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13999
		bgB := bgPaint scaledBlue.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14000
		bgA := bgPaint scaledAlpha.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14001
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14002
		"/ when drawing into a pixmap...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14003
		bgPixel := bgPaint colorId.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14004
		bgPixel == 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14005
		    bgR := bgG := bgB := 0.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14006
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14007
		    bgR := bgG := bgB := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14008
		].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14009
		bgA := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14010
	    ].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14011
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14012
	    "images as background are not yet implemented"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14013
	    "/ #todo: fill background rectangle
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14014
	    bgR := bgG := bgB := bgA := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14015
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14016
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14017
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14018
    screen := device screen.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14019
    self isPixmap ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14020
	pixmapDepth := depth.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14021
    ].
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7416
diff changeset
 14022
    fontId := font getXftFontId.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14023
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14024
%{ /* STACK: 64000 */
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14025
#ifdef XFT
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14026
    XftColor color;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14027
    XGlyphInfo extents;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14028
    XRectangle clipRX;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14029
    char *string;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14030
    int len;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14031
    int __bytesPerCharacter;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14032
    XftDraw *__xftDrawId;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14033
    XftFont *__xftFont;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14034
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14035
    if (!(__bothSmallInteger(drawX, drawY)
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14036
	  && __bothSmallInteger(index1, index2)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14037
	  && __isSmallInteger(bytesPerCharacter)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14038
	  && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14039
	  && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14040
	  && __isNonNilObject(aString)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14041
	  && __isExternalAddress(displayId)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14042
	  && __isExternalAddressLike(fontId)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14043
    )) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14044
	error = @symbol(badArgument);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14045
	goto out;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14046
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14047
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14048
    __xftFont = XFT_FONT(fontId);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14049
    __bytesPerCharacter = __intVal(bytesPerCharacter);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14050
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14051
    if (__INST(xftDrawId) != nil) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14052
	__xftDrawId = __externalAddressVal(__INST(xftDrawId));
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14053
    } else {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14054
	if (pixmapDepth != nil) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14055
	    int __pixmapDepth = __intVal(pixmapDepth);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14056
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14057
	    if (__pixmapDepth == 1) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14058
		__xftDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(__INST(drawableId)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14059
	    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14060
		__xftDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(__INST(drawableId)), __pixmapDepth);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14061
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14062
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14063
	    __xftDrawId = XftDrawCreate(DISPLAY(displayId),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14064
					   DRAWABLE(__INST(drawableId)),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14065
					   DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14066
					   DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14067
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14068
	__INST(xftDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__xftDrawId);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14069
	__STORE(self, newXftDrawId);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14070
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14071
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14072
    string = __stringVal(aString) + ((__intVal(index1) - 1 ) * __bytesPerCharacter);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14073
    len = __intVal(index2) - __intVal(index1) + 1;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14074
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14075
    if (clipX != nil) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14076
	clipRX.x = __intVal(clipX);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14077
	clipRX.y = __intVal(clipY);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14078
	clipRX.width = __intVal(clipW);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14079
	clipRX.height = __intVal(clipH);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14080
	XftDrawSetClipRectangles(__xftDrawId, 0, 0, &clipRX, 1);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14081
    } else {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14082
	XftDrawSetClip(__xftDrawId, 0);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14083
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14084
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14085
    if (opaque == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14086
	if (bgPixel != nil) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14087
	    color.pixel = (unsigned long)__intVal(bgPixel);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14088
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14089
	color.color.red = __intVal(bgR);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14090
	color.color.green = __intVal(bgG);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14091
	color.color.blue = __intVal(bgB);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14092
	color.color.alpha = __intVal(bgA);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14093
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14094
	switch (__bytesPerCharacter) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14095
	case 1:
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14096
	    XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14097
	    break;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14098
	case 2:
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14099
	    XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14100
	    break;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14101
	case 4:
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14102
	    XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14103
	    break;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14104
	}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14105
if (extents.width < 0) printf("width: %d  < 0\n", extents.width);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14106
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14107
	XftDrawRect(__xftDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14108
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14109
    if (__isSmallInteger(fgPixel)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14110
	color.pixel = (unsigned long)__intVal(fgPixel);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14111
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14112
    color.color.red = __intVal(fgR);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14113
    color.color.green = __intVal(fgG);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14114
    color.color.blue = __intVal(fgB);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14115
    color.color.alpha = __intVal(fgA);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14116
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14117
    switch (__bytesPerCharacter) {
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14118
    case 1:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14119
	XftDrawString8(__xftDrawId, &color,__xftFont,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14120
			__intVal(drawX),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14121
			__intVal(drawY),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14122
			(FcChar8*)string,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14123
			len);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14124
	break;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14125
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14126
    case 2:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14127
	XftDrawString16(__xftDrawId, &color, __xftFont,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14128
			__intVal(drawX),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14129
			__intVal(drawY),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14130
			(FcChar16*)string,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14131
			len);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14132
	break;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14133
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14134
    case 4:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14135
	XftDrawString32(__xftDrawId, &color, __xftFont,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14136
			__intVal(drawX),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14137
			__intVal(drawY),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14138
			(FcChar32*)string,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14139
			len);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14140
	break;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14141
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14142
    default:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14143
	error = @symbol(invalidStringSize);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14144
	goto out;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14145
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14146
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14147
out:;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14148
#endif
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14149
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14150
    error notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14151
	self primitiveFailed: error.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14152
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14153
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14154
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14155
!XWorkstation::X11GraphicsContext methodsFor:'drawing'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14156
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14157
XXclearDeviceRectangleX:x y:y width:width height:height
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14158
    device clearRectangleX:x y:y width:width height:height in:drawableId with:gcId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14159
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14160
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14161
XXclearRectangleX:x y:y width:w height:h
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14162
    "draw a filled rectangle; apply transformation if nonNil"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14163
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14164
    |pX pY nW nH pO pC|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14165
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14166
    gcId isNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14167
	self initGC
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14168
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14169
    transformation notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14170
	pO := transformation transformPoint:x@y.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14171
	pC := transformation transformPoint:(x+w-1)@(y+h-1).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14172
	pX := pO x.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14173
	pY := pO y.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14174
	nW := pC x - pX + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14175
	nH := pC y - pY + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14176
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14177
	nW < 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14178
	      nW := nW abs.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14179
	      pX := pX - nW.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14180
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14181
	nH < 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14182
	      nH := nH abs.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14183
	      pY := pY - nH.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14184
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14185
    ] ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14186
	pX := x.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14187
	pY := y.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14188
	nW := w.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14189
	nH := h.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14190
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14191
    pX := pX rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14192
    pY := pY rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14193
    nW := nW rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14194
    nH := nH rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14195
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14196
    device
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14197
	clearRectangleX:pX
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14198
		     y:pY
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14199
		 width:nW
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14200
		height:nH
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14201
		    in:drawableId with:gcId
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14202
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14203
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14204
!XWorkstation::X11GraphicsContext methodsFor:'view creation'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14205
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14206
createBitmapFromArray:data width:width height:height
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14207
    depth := 1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14208
    super createBitmapFromArray:data width:width height:height
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14209
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14210
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14211
createPixmapWidth:w height:h depth:d
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14212
    depth := d.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14213
    super createPixmapWidth:w height:h depth:d
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 14214
! !
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 14215
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 14216
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14217
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14218
version
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 14219
    ^ '$Header$'
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14220
!
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14221
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 14222
version_CVS
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 14223
    ^ '$Header$'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14224
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 14225
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
 14226
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14227
XWorkstation initialize!