XWorkstation.st
author Claus Gittinger <cg@exept.de>
Mon, 24 Jul 2017 15:04:25 +0200
changeset 8053 80e5562b3bec
parent 8024 ac6e7e8cd68c
child 8061 55f525acfbbd
permissions -rw-r--r--
#QUALITY by cg class: XWorkstation changed: #unregisterSelectionFetcher:
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
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1689
    "return the displays preferred size for icons.
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:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
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
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1697
    "Created: 10.6.1996 / 21:06:48 / cg"
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1698
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1699
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1700
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1701
    "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
  1702
     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
  1703
     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
  1704
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1705
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1706
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1707
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1708
smallestMonitorHeight
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1709
    "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
  1710
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1711
    |minH|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1712
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1713
    minH := self usableHeight.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1714
    self monitorBounds do:[:eachBounds |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1715
	minH := minH min: eachBounds height.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1716
    ].
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1717
    ^ minH
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1718
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1719
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1720
	Display smallestMonitorHeight
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1721
    "
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
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1724
supportedClipboards
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1725
    "answer a collection of symbols with the supported clipboards.
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1726
     X11 additionaly supports a buffer containing the currently selected text
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1727
     (in xterm) - the PRIMARY selection"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1728
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1729
    ^ #(clipboard selection)
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1730
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1731
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1732
supportedImageFormats
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1733
    "return an array with supported image formats;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1734
     each array entry is an attribute dictionary, consisting of
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1735
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1736
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1737
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1738
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1739
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1740
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1741
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1742
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1743
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1744
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1745
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1746
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1747
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1748
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1749
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1750
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1751
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1752
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1753
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1754
    1 to:nFormats do:[:index |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1755
	|info bitsPerPixelInfo depthInfo paddingInfo i|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1756
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1757
	i := index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1758
%{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1759
	ScreenFormat *format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1760
	Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1761
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1762
#ifdef NO_PRIVATE_DISPLAY_ACCESS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1763
	depthInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1764
	bitsPerPixelInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1765
	paddingInfo = __MKSMALLINT(8);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1766
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1767
	format = DISPLAYACCESS(dpy)->pixmap_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1768
	format += (__intVal(i)-1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1769
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1770
	depthInfo = __MKSMALLINT(format->depth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1771
	paddingInfo = __MKSMALLINT(format->scanline_pad);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1772
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1773
%}.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1774
	info := IdentityDictionary new.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1775
	info at:#depth put:depthInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1776
	info at:#bitsPerPixel put:bitsPerPixelInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1777
	info at:#padding put:paddingInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1778
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1779
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1780
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1781
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1782
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1783
     Display supportedImageFormats
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1784
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1785
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1786
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1787
supportsAnyViewBackgroundPixmaps
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1788
    "return true, if the device allows pixmaps as viewBackground."
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1789
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1790
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1791
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1792
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1793
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1794
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1795
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1796
    "return true, if this workstation supports arbitrary shaped windows.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1797
     Both the server must support it (the shape-extension),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1798
     and the feature must have been enabled in the smalltalk system,
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1799
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1800
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1801
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1802
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1803
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1804
     Display supportsArbitraryShapedViews
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1805
    "
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
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1808
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1809
    "return true, if this device supports views as icons.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1810
     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
  1811
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1812
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1813
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1814
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1815
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1816
     Display supportsIconViews
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1817
    "
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
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1820
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1821
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1822
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1823
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1824
    "return true, if the device allows the given form pixmap
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1825
     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
  1826
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1827
7021
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1828
    ^ true
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1829
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1830
    "Created: / 4.5.1999 / 12:16:43 / cg"
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1831
!
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
supportsMaskedDrawingWithOffset:aForm
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1834
    "return true, if the device allows the given form pixmap
7022
f4531f98fd46 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7021
diff changeset
  1835
     to be used as paint color with a mask offset.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1836
     True returned here - X has no trouble with any mask."
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1837
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1838
    "/ XQuartz seems to have a bug here...
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  1839
    ^ OperatingSystem isOSXlike not.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1840
    "/ ^ true.
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1841
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1842
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1843
supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1844
    "return true, if the device allows reading the screen pixels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1845
     True returned here - X can do it"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1846
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1847
    "XQuartz seems to have a bug here...
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1848
     ...but only on XQuartz servers.
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1849
     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
  1850
     it does not return a valid server vendor string"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1851
    OperatingSystem isOSXlike ifTrue:[
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1852
        ^ false
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1853
    ].
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1854
    ^ true
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1855
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1856
    "
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1857
     Display serverVendor
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1858
     Display supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1859
    "
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1860
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1861
    "Modified (comment): / 13-02-2017 / 20:35:34 / cg"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1862
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1863
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1864
supportsUTF8WindowLabels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1865
    "answer true, if window labels are to be utf-8 encoded"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1866
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1867
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1868
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1869
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1870
supportsVariableHeightFonts
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1871
    "are fonts with variable height supported?"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1872
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1873
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1874
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1875
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1876
supportsViewBackgroundPixmap:aForm
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1877
    "return true, if the device allows the given pixmap as viewBackground.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1878
     True returned here - X supports any size.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1879
     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
  1880
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1881
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1882
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1883
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1884
    "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
  1885
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1886
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1887
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1888
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1889
     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
  1890
     are faster, if they are."
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1891
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1892
    ^ true
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1893
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1894
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1895
supportsXCursor
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1896
    "return true, if the XCursor extension (deep cursors ) are supported
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1897
     on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1898
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1899
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1900
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1901
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1902
     ^ self class hasXCursorLibrary
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1903
	and:[self hasCursorExtension]
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1904
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
     Display supportsXCursor
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1907
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1908
     Display class hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1909
    "
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
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1912
supportsXftFonts
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1913
    "return true, if XftFonts (nice looking truetype fonts)
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1914
     are supported on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1915
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1916
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1917
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1918
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  1919
     ^ XftFontDescription notNil and:[hasXftLibrary].
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1920
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1921
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1922
     Display supportsXftFonts
6975
da4fb0542fca #FEATURE
Claus Gittinger <cg@exept.de>
parents: 6958
diff changeset
  1923
     Display hasRenderExtension
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1924
     Display class hasXftLibrary
6538
04f9cecef7c3 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6522
diff changeset
  1925
    "
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1926
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1927
7699
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1928
supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1929
    "return true, if XftFonts (nice looking truetype fonts)
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1930
     are supported when drawing into bitmaps on this display.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1931
     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
  1932
     rendering into bitmaps"
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1933
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1934
     ^ false.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1935
     "/ ^ self supportsXftFonts
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1936
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
     Display supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1939
     Display hasRenderExtension
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1940
     Display class hasXftLibrary
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1941
    "
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
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1944
suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1945
    "return true, if this device wants to suppress shadow views
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1946
     (i.e. shadows under popups and modalBoxes).
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1947
     Some (slow) devices may want to return true here.
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1948
     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
  1949
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1950
    OperatingSystem isOSXlike ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1951
	^ true
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1952
    ].
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1953
    ^ super suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1954
!
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1955
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1956
usableHeightAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1957
    "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
  1958
     Normally, the same as height, but may be smaller, in
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1959
     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
  1960
     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
  1961
     which display is at the given x-position"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1962
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1963
    |h|
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1964
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1965
    h := (self monitorBoundsAt:aPoint) height.
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1966
    OperatingSystem isOSXlike ifTrue:[
7965
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1967
        "/ take away some space for the dock at the bottom.
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1968
        ^ h - 50
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1969
    ].
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1970
    ^ h
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1971
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
     Screen current usableHeightAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1974
     Screen current usableHeightAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1975
     Screen current usableHeightAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1976
     Screen current usableHeightAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1977
     Screen current usableHeightAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1978
    "
7965
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1979
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1980
    "Modified (format): / 05-03-2017 / 11:25:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1981
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1982
48194c26a46c Initial revision
claus
parents:
diff changeset
  1983
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1984
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1985
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1986
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1987
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1988
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1989
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1990
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1991
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1992
    bitmapId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1993
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1994
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1995
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1996
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1997
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1998
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1999
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2000
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2001
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2002
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2003
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2004
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2005
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2006
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2007
     && __isStringLike(aString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2008
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2009
	char *filename;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2010
	int status;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2011
	Pixmap newBitmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2012
	unsigned b_width, b_height;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2013
	int b_x_hot, b_y_hot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2014
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2015
	filename = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2016
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2019
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2020
				 filename, &b_width, &b_height, &newBitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2021
				 &b_x_hot, &b_y_hot);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2022
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2023
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
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2026
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2027
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2028
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2029
	    w = __MKSMALLINT(b_width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2030
	    h = __MKSMALLINT(b_height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2031
	    id = __MKEXTERNALADDRESS(newBitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2032
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2033
    }
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
    id notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2036
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2037
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2038
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2039
!
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
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2042
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2043
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2044
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2045
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2046
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2047
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2048
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2049
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2050
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2051
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2052
	Display *dpy = myDpy;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2053
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
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2056
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2057
				       __intVal(w), __intVal(h), 1);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2058
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2059
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2060
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2061
	    __cnt_bitmap++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2062
#endif
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2063
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2064
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2065
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2066
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2067
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2068
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2069
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2070
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2071
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  2072
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  2073
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2074
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2075
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2076
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2077
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2078
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2079
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2080
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2081
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2082
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2083
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2086
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2087
				       __intVal(w), __intVal(h), __intVal(d));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2088
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2089
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2090
	if (newBitmap)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2091
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2092
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2093
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2094
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2095
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  2096
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2097
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2098
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2099
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2100
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  2101
createWindowFor:aView type:typeSymbol
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2102
                 origin:origin
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2103
                 extent:extent
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2104
                 minExtent:minExt
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2105
                 maxExtent:maxExt
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2106
                 borderWidth:bWidth
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2107
                 subViewOf:wsuperView
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2108
                 style:wStyle
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2109
                 inputOnly:winputOnly
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2110
                 label:wlabel
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2111
                 owner:wowner
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2112
                 icon:wicon iconMask:wiconMask
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2113
                 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2114
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2115
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2116
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2117
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2118
     bColorId wsuperViewId windowId isTopWindow
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2119
     weventMask bitGravity viewGravity vBgColor
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  2120
     vBgForm deepForm preferredVisual preferredDepth
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2121
     wiconId wiconMaskId wiconViewId windowGroupWindowId|
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2122
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2123
    self isOpen ifFalse:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2124
        self primitiveFailedOrClosedConnection.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2125
        ^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2126
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2127
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2128
    origin notNil ifTrue:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2129
        xpos := origin x.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2130
        ypos := origin y.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2131
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2132
    extent notNil ifTrue:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2133
        wwidth := extent x.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2134
        wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2135
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2136
    minExt notNil ifTrue:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2137
        minWidth := minExt x.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2138
        minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2139
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2140
    maxExt notNil ifTrue:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2141
        maxWidth := maxExt x.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2142
        maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2143
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2144
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2145
    wsuperView notNil ifTrue:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2146
        wsuperViewId := wsuperView id
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2147
    ] ifFalse:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2148
        isTopWindow := true.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2149
        aView class ~~ WindowGroupWindow ifTrue:[
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2150
            windowGroupWindow isNil ifTrue:[
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2151
                self getWindowGroupWindow.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2152
            ].
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2153
            windowGroupWindowId := windowGroupWindow id.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2154
        ].
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2155
        wicon notNil ifTrue:[
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2156
            wiconId := wicon id.
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2157
            wiconMask notNil ifTrue:[
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2158
                wiconMaskId := wiconMask id
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2159
            ]
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2160
        ].
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2161
        wiconView notNil ifTrue:[
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2162
            wiconViewId := wiconView id
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2163
        ].
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2164
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2165
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2166
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2167
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2168
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2169
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2170
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2171
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  2172
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2173
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2174
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2175
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2176
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2177
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2178
    XSizeHints sizehints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2179
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2180
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2181
    XFontStruct *f;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2182
    Pixmap backPixmap = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2183
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2184
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2185
    Atom WmQuitAppAtom, MotifWMHintsAtom;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  2186
    Atom STXDeviceAtom, UUIDAtom;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2187
    Atom atoms[3];
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2188
    int atomCount = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2189
48194c26a46c Initial revision
claus
parents:
diff changeset
  2190
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2191
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2192
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2193
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2194
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2195
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2196
    if (__bothSmallInteger(wwidth, wheight)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2197
        sizehints.flags |= PSize;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2198
        sizehints.width = __intVal(wwidth);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2199
        sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2200
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2201
    if (__bothSmallInteger(xpos, ypos)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2202
        sizehints.flags |= PPosition;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2203
        sizehints.x = __intVal(xpos);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2204
        sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2205
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2206
    if (__bothSmallInteger(minWidth, minHeight)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2207
        sizehints.flags |= PMinSize;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2208
        sizehints.min_width = __intVal(minWidth);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2209
        sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2210
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2211
    if (__bothSmallInteger(maxWidth, maxHeight)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2212
        sizehints.flags |= PMaxSize;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2213
        sizehints.max_width = __intVal(maxWidth);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2214
        sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2215
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2216
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  2217
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2218
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2219
    if (__isSmallInteger(bWidth)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2220
        bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2221
    } else {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2222
        bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2223
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2224
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2225
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2226
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2227
    if (__isExternalAddress(wsuperViewId)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2228
        parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2229
    } else {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2230
        parentWindow = RootWindow(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2231
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2232
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  2233
    if (wStyle == @symbol(popUp))
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2234
        xswa.override_redirect = 1;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2235
    else
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2236
        xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2237
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2238
    if (winputOnly == true)
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2239
        ioClass = InputOnly;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2240
    else
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2241
        ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2242
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2243
    if (__isSmallInteger(weventMask)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2244
        xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2245
    } else {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2246
        xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2247
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2248
48194c26a46c Initial revision
claus
parents:
diff changeset
  2249
    if (ioClass == InputOnly) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2250
        bw = 0;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2251
        depth = 0;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2252
        flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2253
    } else {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2254
        depth = DefaultDepth(dpy,screen);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2255
        flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2256
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2257
        if (backPixmap != (Pixmap)0) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2258
            xswa.background_pixmap = backPixmap;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2259
            flags |= CWBackPixmap;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2260
        } else {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2261
            xswa.background_pixel = bg;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2262
            flags |= CWBackPixel;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2263
        }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2264
        xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2265
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2266
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2267
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2268
    if (__isSmallInteger(preferredDepth)) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2269
        depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2270
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2271
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2272
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2273
    if (preferredVisual != nil) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2274
        XVisualInfo vi;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2275
        int cls;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2276
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2277
        if (preferredVisual == @symbol(StaticGray))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2278
            cls = StaticGray;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2279
        else if (preferredVisual == @symbol(GrayScale))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2280
            cls = GrayScale;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2281
        else if (preferredVisual == @symbol(StaticColor))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2282
            cls = StaticColor;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2283
        else if (preferredVisual == @symbol(PseudoColor))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2284
            cls = PseudoColor;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2285
        else if (preferredVisual == @symbol(TrueColor))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2286
            cls = TrueColor;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2287
        else if (preferredVisual == @symbol(DirectColor))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2288
            cls = DirectColor;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2289
        else
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2290
            cls = PseudoColor;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2291
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2292
        ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2293
        if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2294
            visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  2295
/*
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2296
            console_fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  2297
*/
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2298
        }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2299
        LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2300
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2301
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2302
    ENTER_XLIB2();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2303
    newWindow = XCreateWindow(dpy, parentWindow,
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2304
                           sizehints.x, sizehints.y,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2305
                           sizehints.width, sizehints.height,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2306
                           bw, depth, ioClass, &visual,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2307
                           flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2308
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2309
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2310
48194c26a46c Initial revision
claus
parents:
diff changeset
  2311
    if (! newWindow) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2312
        RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2313
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2314
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2315
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2316
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2317
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2318
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2319
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  2320
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  2321
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  2322
     */
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2323
    if (isTopWindow == true) {
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2324
        XWMHints wmhints;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2325
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2326
        wmhints.flags = 0;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2327
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2328
        if (__isExternalAddress(wiconId)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2329
            wmhints.icon_pixmap = __PixmapVal(wiconId);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2330
            wmhints.flags = IconPixmapHint;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2331
            if (__isExternalAddress(wiconMaskId)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2332
                wmhints.icon_mask = __PixmapVal(wiconMaskId);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2333
                wmhints.flags |= IconMaskHint;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2334
            }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2335
        }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2336
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2337
        if (__isExternalAddress(windowGroupWindowId)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2338
            wmhints.window_group = __WindowVal(windowGroupWindowId);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2339
            wmhints.flags |= WindowGroupHint;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2340
        }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2341
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2342
        if (__isExternalAddress(wiconViewId)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2343
            wmhints.flags |= IconWindowHint;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2344
            wmhints.icon_window = __WindowVal(wiconViewId);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2345
        };
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2346
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2347
/*
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2348
        wmhints.flags |= InputHint;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2349
        wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2350
*/
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2351
        ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2352
        XSetWMHints(dpy, newWindow, &wmhints);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2353
        XSetWMNormalHints(dpy, newWindow, &sizehints);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2354
        LEAVE_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2355
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2356
        /*
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2357
         * get atoms first (if not already known)
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2358
         */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2359
        if (__INST(protocolsAtom) == nil) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2360
            ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2361
            WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2362
            __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2363
#ifdef USE_SAVEYOURSELF_ATOM
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2364
            WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2365
            __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2366
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2367
#ifdef USE_QUIT_APP_ATOM
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2368
            WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2369
            __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2370
#endif
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2371
            WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2372
            __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2373
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2374
            UUIDAtom = XInternAtom(dpy, "UUID", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2375
            __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2376
            STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2377
            __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2378
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2379
            LEAVE_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2380
        } else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2381
#ifdef USE_QUIT_APP_ATOM
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2382
            WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2383
#else
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2384
            WmQuitAppAtom = 0;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2385
#endif
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2386
            WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2387
            WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2388
#ifdef USE_SAVEYOURSELF_ATOM
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2389
            WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2390
#else
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2391
            WmSaveYourselfAtom = 0;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2392
#endif
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2393
            UUIDAtom = __AtomVal(__INST(uuidAtom));;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2394
            STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2395
        }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2396
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2397
        /*
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2398
         * tell window manager to not kill us but send an event instead
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2399
         */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2400
        atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2401
#ifdef USE_SAVEYOURSELF_ATOM
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2402
        atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2403
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2404
#ifdef USE_QUIT_APP_ATOM
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2405
        atoms[atomCount] = WmQuitAppAtom; atomCount++;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2406
#endif
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2407
        ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2408
        XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2409
                        32, PropModeReplace, (unsigned char *)atoms, atomCount);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2410
        LEAVE_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2411
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2412
        /*
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2413
         * an optional unique id (to mark stx-windows)
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2414
         */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2415
        if (__isBytes(__INST(uniqueDeviceID))) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2416
            int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2417
            unsigned char uuidBytes[32];
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2418
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2419
            if (numUUIDBytes <= sizeof(uuidBytes)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2420
                Atom uuidAtom;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2421
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2422
                bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2423
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2424
                ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2425
                XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2426
                                 uuidBytes, numUUIDBytes );
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2427
                LEAVE_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2428
            }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2429
        }
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2430
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2431
#ifdef SUPPORT_MOTIF_WM_HINTS
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2432
        /*
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2433
         * less decoration
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2434
         */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2435
        if ((wStyle == @symbol(undecorated))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2436
         || (wStyle == @symbol(dialog2))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2437
         || (wStyle == @symbol(notitle))
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2438
        ) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2439
            if (__INST(motifWMHintsAtom) == nil) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2440
                ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2441
                MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2442
                __INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2443
                LEAVE_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2444
            } else {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2445
                MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2446
            }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2447
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2448
            {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2449
                struct hints {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2450
                    unsigned long flags;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2451
                    unsigned long functions;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2452
                    unsigned long decorations;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2453
                    long input_mode;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2454
                    unsigned long status;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2455
                } mvm_hints;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2456
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2457
                if (wStyle == @symbol(undecorated)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2458
                    mvm_hints.decorations = MWM_DECOR_NONE;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2459
                }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2460
                if (wStyle == @symbol(dialog2)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2461
                    mvm_hints.decorations = MWM_DECOR_BORDER
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2462
                                            | MWM_DECOR_RESIZEH
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2463
                                            | MWM_DECOR_TITLE
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2464
                                            /* | MWM_DECOR_MENU */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2465
                                            /* | MWM_DECOR_MINIMIZE */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2466
                                            /* | MWM_DECOR_MAXIMIZE */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2467
                                            ;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2468
                }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2469
                if (wStyle == @symbol(notitle)) {
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2470
                    mvm_hints.decorations = MWM_DECOR_BORDER
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2471
                                            /* | MWM_DECOR_RESIZEH  */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2472
                                            /* | MWM_DECOR_TITLE    */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2473
                                            /* | MWM_DECOR_MENU     */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2474
                                            /* | MWM_DECOR_MINIMIZE */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2475
                                            /* | MWM_DECOR_MAXIMIZE */
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2476
                                            ;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2477
                }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2478
                mvm_hints.flags =  MWM_HINTS_DECORATIONS;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2479
                ENTER_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2480
                XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2481
                                     MotifWMHintsAtom, 32, PropModeReplace,
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2482
                                     (unsigned char*)&mvm_hints, 5 );
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2483
                LEAVE_XLIB();
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2484
            }
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2485
        }
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  2486
#endif /* SUPPORT_MOTIF_WM_HINTS */
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2487
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2488
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2489
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2490
%}.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2491
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2492
"/    (wStyle ~= nil and:[wStyle ~= #normal]) ifTrue:[
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2493
"/        self setWindowType:wStyle in:windowId.
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2494
"/    ].
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2495
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2496
    (wsuperView isNil "this is a topwindow"
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2497
     and:[wlabel notEmptyOrNil]) ifTrue:[
7983
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2498
        self
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2499
            setIconName:wlabel in:windowId;
6ceb649e90f0 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7976
diff changeset
  2500
            setWindowName:wlabel in:windowId.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2501
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2502
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
  2503
    self addKnownView:aView withId:windowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2504
    ^ windowId
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2505
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2506
    "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
  2507
    "Modified: / 18-03-2017 / 00:00:44 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2508
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2509
48194c26a46c Initial revision
claus
parents:
diff changeset
  2510
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2511
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2512
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2513
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2514
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2515
     * 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
  2516
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2517
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2518
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2519
    }
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
    if (__isExternalAddress(aGCId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2522
	GC gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2523
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2524
	if (gc) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2525
	    __ExternalAddressInstPtr(aGCId)->e_address = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2526
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2527
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2528
	    XFreeGC(myDpy, gc);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2529
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2530
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2531
	    __cnt_gc--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2532
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2533
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2534
	    console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2535
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2536
	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
  2537
    }
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
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2540
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2541
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2542
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2543
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2544
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2545
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2546
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2547
     * 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
  2548
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2549
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2550
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2551
    }
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
    if (__isExternalAddress(aDrawableId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2554
	Pixmap pix = __PixmapVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2555
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2556
	if (pix) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2557
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2558
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2559
	    XFreePixmap(myDpy, pix);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2560
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2561
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2562
	    __cnt_bitmap--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2563
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2564
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
	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
  2567
    }
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
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2570
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2571
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2572
destroyView:aViewOrNil withId:aWindowId
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2573
    XftFontDescription notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  2574
	XftFontDescription aboutToDestroyViewWithDevice:self id:aWindowId.
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2575
    ].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2576
    self primDestroyViewWithId:aWindowId.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2577
    self removeKnownView:aViewOrNil withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2578
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2579
48194c26a46c Initial revision
claus
parents:
diff changeset
  2580
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2581
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2582
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2583
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2584
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2585
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2586
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2587
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2588
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2589
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2590
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2591
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2592
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2593
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2594
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2595
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2596
				       __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2597
				       0, height, 0, colormap, NULL, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2598
				       XDPSDefaultTextBackstop,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2599
				       XDPSDefaultErrorProc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2600
				       NULL);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2601
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2602
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2603
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2604
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2605
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2606
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2607
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2608
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2609
!
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
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2612
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2613
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2614
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2615
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2616
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2617
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2618
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2619
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2620
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2621
	gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2622
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2623
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2624
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2625
	if (gc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2626
	    __cnt_gc++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2627
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2628
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2629
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2630
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2631
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2632
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2633
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2634
!
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
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2637
    "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
  2638
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2639
    ^ self gcFor:aDrawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2640
!
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
primCreateBitmapFromArray:anArray width:w height:h
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2643
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2644
154
claus
parents: 153
diff changeset
  2645
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2646
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2647
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2648
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2649
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2650
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2651
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2652
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2653
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2654
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2655
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2656
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2657
    static char reverseBitTable[256];
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  2658
    static int firstCall = 1;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2659
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2660
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2661
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2662
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2663
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2664
    if (! ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2665
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2666
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2667
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2668
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2669
    if (firstCall) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2670
	for (index=0; index < 256; index++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2671
	    int t = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2672
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2673
	    if (index & 128) t |=   1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2674
	    if (index &  64) t |=   2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2675
	    if (index &  32) t |=   4;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2676
	    if (index &  16) t |=   8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2677
	    if (index &   8) t |=  16;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2678
	    if (index &   4) t |=  32;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2679
	    if (index &   2) t |=  64;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2680
	    if (index &   1) t |= 128;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2681
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2682
	    reverseBitTable[index] = t;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2683
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2684
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2685
    }
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
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2688
	newBitmap = (Pixmap)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2689
	b_width = __intVal(w);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2690
	b_height = __intVal(h);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2691
	bytesPerRow = (b_width + 7) / 8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2692
	nBytes = b_height * bytesPerRow;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2693
	if (nBytes < sizeof(fastBits)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2694
	    cp = b_bits = fastBits;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2695
	    allocatedBits = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2696
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2697
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2698
	    if (! cp) goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2699
	}
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
	if (__isArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2702
	    index = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2703
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2704
	    for (row = b_height; row; row--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2705
		for (col = bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2706
		    num = *op++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2707
		    if (__isSmallInteger(num)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2708
			bits = __intVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2709
		    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2710
			bits = __longIntVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2711
			if (bits == 0) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2712
			    goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2713
			}
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
		    *cp++ = reverseBitTable[bits & 0xFF];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2716
		}
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
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2719
	    if (__isByteArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2720
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2721
		for (col = b_height*bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2722
		    *cp++ = reverseBitTable[*pBits++];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2723
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2724
	    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2725
		goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2726
	    }
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
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2731
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2732
					       (char *)b_bits,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2733
					       b_width, b_height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2734
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2735
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2736
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2737
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2738
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2739
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2740
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2741
fail: ;
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2742
	if (allocatedBits)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2743
	    free(allocatedBits);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2744
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2745
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2746
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2747
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2748
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2749
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2750
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
  2751
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2752
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2753
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2754
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
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2757
primDestroyViewWithId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2758
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2759
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2760
    if (! ISCONNECTED) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2761
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2762
    }
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
    if (__isExternalAddress(aWindowId)) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2765
	Window win = __WindowVal(aWindowId);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2766
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2767
	if (win) {
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2768
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2769
	    ENTER_XLIB();
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2770
	    XDestroyWindow(myDpy, win);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2771
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2772
#ifdef COUNT_RESOURCES
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2773
	    __cnt_view--;
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2774
#endif
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2775
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2776
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2777
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2778
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2779
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2780
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2781
!XWorkstation methodsFor:'clipboard'!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2782
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2783
getPrimaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2784
    "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
  2785
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2786
    ^ primaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2787
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2788
    "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
  2789
!
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
primaryBufferAsString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2792
    "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
  2793
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
  2794
    ^ self class bufferAsString:self getPrimaryBuffer.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2795
!
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
setPrimaryBuffer:aString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2798
    "Sets the contents of PRIMARY selection."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2799
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2800
    primaryBuffer := aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2801
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2802
    "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
  2803
!
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
setPrimaryText:aString ownerView:aView
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2806
    "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
  2807
     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
  2808
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2809
    |s viewID|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2810
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2811
    self setPrimaryBuffer:aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2812
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2813
    s := aString ? ''.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2814
    s isString ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2815
	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
  2816
    ].
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
    viewID := aView id.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2819
    viewID notNil ifTrue:[ "/ if the view is not already closed
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2820
	"/ for now - should add support to pass emphasis information too
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2821
	s := s string.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2822
	self setPrimaryText:s owner:viewID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2823
    ]
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
    "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
  2826
! !
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2827
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2828
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2829
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2830
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2831
    "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
  2832
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2833
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2834
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2835
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2836
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2837
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2838
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2839
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2840
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2841
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2842
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2843
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2844
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2847
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2848
				   &dummy, 0, &color.pixel, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2849
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2850
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2851
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2852
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2853
	    __cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2854
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2855
	    RETURN ( __MKSMALLINT(color.pixel) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2856
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2857
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2858
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2859
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2860
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2861
48194c26a46c Initial revision
claus
parents:
diff changeset
  2862
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
  2863
    "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
  2864
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2865
     and the returned colorID is formed by simply packing the RGB values.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2866
     Don't use this method, colornames are mostly X specific."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2867
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2868
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2869
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2870
48194c26a46c Initial revision
claus
parents:
diff changeset
  2871
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2872
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2873
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2874
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2875
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2876
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2877
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2878
     && __isStringLike(aString)) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2879
	Display *dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2880
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2881
	colorname = (char *) __stringVal(aString);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2882
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2883
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2884
	ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2885
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2886
	LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2887
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2888
#ifdef QUICK_TRUE_COLORS
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2889
	    if (__INST(visualType) == @symbol(TrueColor)) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2890
		id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2891
		id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2892
		id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2893
		RETURN ( __MKSMALLINT(id) );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2894
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2895
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2896
	    ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2897
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2898
	    LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2899
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2900
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2901
	if (! ok) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2902
	    RETURN ( nil );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2903
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2904
#ifdef COUNT_RESOURCES
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2905
	__cnt_color++;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2906
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2907
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2908
    }
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
    ^ 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
  2911
!
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
colorScaledRed:r scaledGreen:g scaledBlue:b
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2914
    "allocate a color with rgb values (0..16rFFFF)
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2915
     - return the color index (i.e. colorID).
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2916
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2917
     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
  2918
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2919
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2920
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2921
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2922
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2923
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2924
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2925
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2926
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2927
    if (__bothSmallInteger(r, g)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2928
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2929
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2930
	ecolor.red = __intVal(r);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2931
	ecolor.green= __intVal(g);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2932
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2933
#ifdef QUICK_TRUE_COLORS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2934
	if (__INST(visualType) == @symbol(TrueColor)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2935
	    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
  2936
	    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
  2937
	    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
  2938
	    RETURN ( __MKSMALLINT(id) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2939
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2940
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2941
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2942
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2943
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2944
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2945
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2946
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2947
	if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2948
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2949
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2950
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2951
	__cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2952
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2953
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2954
    }
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
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2957
!
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
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2960
    "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
  2961
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2962
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2963
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2964
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2965
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2966
     Display deviceColorValueToPercent:0
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2967
     Display deviceColorValueToPercent:16r8000
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2968
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2969
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2970
!
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
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2973
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2974
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2975
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2976
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2977
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2978
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2979
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2980
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2981
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2982
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2983
    if (__INST(visualType) == @symbol(TrueColor)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2984
	/* no need to do anything on TrueColor displays ... */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2985
	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
  2986
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2987
#endif
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2988
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
     * 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
  2991
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2992
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2993
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2994
    }
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
    if (__isSmallInteger(colorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2997
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2998
	color = (long) __intVal(colorIndex);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2999
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3000
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3001
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3002
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3003
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3004
	__cnt_color--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3005
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3006
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3007
	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
  3008
    }
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
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3011
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3012
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3013
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
  3014
    "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
  3015
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3016
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3017
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3018
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3019
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3020
    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
  3021
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3022
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3023
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3024
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3025
     && __isSmallInteger(index)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3026
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3027
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3028
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3029
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3030
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3031
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3032
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3033
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
	 * 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
  3037
	 * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3038
	 * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3039
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3040
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3041
	bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3042
	scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3043
	shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3044
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3045
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3046
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3047
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3048
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3049
    }
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
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3052
!
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
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
  3055
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3056
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3057
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3058
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3059
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3060
    XColor color;
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3061
    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
  3062
    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
  3063
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3064
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3065
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  3066
     && __isStringLike(colorName)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3067
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3068
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
	if (XParseColor(dpy, DefaultColormap(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3071
			     (char *) __stringVal(colorName), &color)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3072
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3073
	     * 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
  3074
	     * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3075
	     * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3076
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3077
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3078
	    bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3079
	    scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3080
	    shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3081
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3082
	    /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3083
	    dr = color.red>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3084
	    dg = color.green>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3085
	    db = color.blue>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3086
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3087
	    sr = (dr / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3088
	    sg = (dg / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3089
	    sb = (db / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3090
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3091
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3092
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
    ^ super getScaledRGBFromName:colorName
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3096
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3097
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3098
	Screen current getScaledRGBFromName:'red'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3099
	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
  3100
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3101
!
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
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3104
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3105
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3106
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3107
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3108
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3109
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  3110
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3111
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3112
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3113
    [aStream atEnd] whileFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3114
	line := aStream nextLine.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3115
	line notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3116
	    "skip the r/g/b numbers"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3117
	    index := 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3118
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3119
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3120
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3121
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3122
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3123
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3124
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3125
	    colorName := line copyFrom:index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3126
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3127
		list add:colorName
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3128
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3129
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3130
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3131
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3132
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3133
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
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3136
    "
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
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3139
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3140
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3141
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3142
    "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
  3143
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3144
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3145
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3146
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3147
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3148
    if (__isSmallInteger(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3149
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3150
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3151
    if (__isFloat(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3152
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3153
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3154
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3155
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3156
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3157
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3158
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
  3159
    "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
  3160
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3161
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3162
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3163
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3164
48194c26a46c Initial revision
claus
parents:
diff changeset
  3165
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3166
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3167
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3168
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3169
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3170
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3171
    if (__isSmallInteger(sred))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3172
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3173
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3174
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3175
    if (__isSmallInteger(sgreen))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3176
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3177
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3178
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3179
    if (__isSmallInteger(sblue))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3180
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3181
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3182
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3183
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3184
     && __isSmallInteger(index) && ok) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3185
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3186
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3187
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3188
	color.red = r;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3189
	color.green = g;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3190
	color.blue = b;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3191
	color.flags = DoRed | DoGreen | DoBlue;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3192
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3195
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3196
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3197
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3198
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3199
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3200
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3201
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3202
! !
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
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3205
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3206
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3207
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3208
     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
  3209
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3210
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3211
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3212
    "/ 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
  3213
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3214
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3215
	#upLeftArrow            "/ XC_top_left_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3216
	#upRightHand            "/ XC_hand1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3217
	#upDownArrow            "/ XC_sb_v_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3218
	#leftRightArrow         "/ XC_sb_h_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3219
	#upLimitArrow           "/ XC_top_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3220
	#downLimitArrow         "/ XC_bottom_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3221
	#leftLimitArrow         "/ XC_left_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3222
	#rightLimitArrow        "/ XC_right_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3223
	#text                   "/ XC_xterm
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3224
	#upRightArrow           "/ XC_draft_large
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3225
	#leftHand               "/ XC_hand2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3226
	#questionMark           "/ XC_question_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3227
	#cross                  "/ XC_X_cursor
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3228
	#wait                   "/ XC_watch
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3229
	#crossHair              "/ XC_tcross
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3230
	#origin                 "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3231
	#topLeft                "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3232
	#corner                 "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3233
	#bottomRight            "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3234
	#topRight               "/ XC_ur_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3235
	#bottomLeft             "/ XC_ll_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3236
	#square                 "/ XC_dotbox
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3237
	#fourWay                "/ XC_fleur
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3238
	#crossCursor            "/ XC_X_cursor
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3239
      )
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
    "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
  3242
    "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
  3243
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3244
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3245
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3246
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3247
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3248
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3249
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3250
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3251
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3252
    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
  3253
    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
  3254
    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
  3255
    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
  3256
    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
  3257
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3258
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3259
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3260
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3261
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3262
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3263
     && __bothSmallInteger(fgG, fgB)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3264
     && __bothSmallInteger(bgR, bgG)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3265
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3266
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3267
	fgcolor.red = __intVal(fgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3268
	fgcolor.green= __intVal(fgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3269
	fgcolor.blue = __intVal(fgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3270
	bgcolor.red = __intVal(bgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3271
	bgcolor.green= __intVal(bgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3272
	bgcolor.blue = __intVal(bgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3273
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3274
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3275
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3276
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3277
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3278
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  3279
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3280
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3281
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3282
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3283
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3284
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3285
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3286
     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
  3287
     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
  3288
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3289
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3290
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3291
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3292
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3293
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3294
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3295
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3296
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
  3297
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3298
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3299
    ^ self
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3300
	primCreateCursorSourceFormId:sourceForm id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3301
	maskFormId:maskForm id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3302
	hotX:hx hotY:hy
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3303
	width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3304
!
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
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3307
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3308
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3309
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3310
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3311
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3312
     * 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
  3313
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3314
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3315
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3316
    }
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
    if (__isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3319
	Cursor curs = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3320
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3321
	if (curs) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3322
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3323
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3324
	    XFreeCursor(myDpy, curs);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3325
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3326
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3327
	    __cnt_cursor--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3328
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3329
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3330
	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
  3331
    }
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
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3334
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3335
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3336
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3337
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3338
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3339
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3340
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3341
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3342
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3343
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3344
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3345
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3346
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3347
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3348
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3349
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3350
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3351
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3352
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3353
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3354
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3355
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3356
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3357
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3358
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3359
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3360
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3361
    }
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
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3364
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3365
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3366
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3367
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3368
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3369
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3370
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3371
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3372
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3373
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3374
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3375
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3376
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3377
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3378
     && __bothSmallInteger(hx, hy)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3379
	fgColor.red = 0;        /* fg is black */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3380
	fgColor.green = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3381
	fgColor.blue = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3382
	bgColor.red = 0xFFFF;   /* bg is white */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3383
	bgColor.green = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3384
	bgColor.blue = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3385
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3388
	newCursor = XCreatePixmapCursor(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3389
				__PixmapVal(sourceId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3390
				__PixmapVal(maskId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3391
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3392
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3393
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3394
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3395
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3396
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3397
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3398
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3399
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3400
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3401
    }
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
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3404
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3405
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3406
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3407
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3408
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3409
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3410
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3411
    "/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
  3412
    "/ 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
  3413
6873
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3414
%{  /* NOCONTEXT */
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3415
    if (shape == @symbol(upLeftArrow)) RETURN ( __MKSMALLINT(XC_top_left_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3416
    if (shape == @symbol(upRightHand)) RETURN (  __MKSMALLINT(XC_hand1) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3417
    if (shape == @symbol(upDownArrow)) RETURN (  __MKSMALLINT(XC_sb_v_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3418
    if (shape == @symbol(leftRightArrow)) RETURN (  __MKSMALLINT(XC_sb_h_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3419
    if (shape == @symbol(upLimitArrow)) RETURN (  __MKSMALLINT(XC_top_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3420
    if (shape == @symbol(downLimitArrow)) RETURN (  __MKSMALLINT(XC_bottom_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3421
    if (shape == @symbol(leftLimitArrow)) RETURN (  __MKSMALLINT(XC_left_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3422
    if (shape == @symbol(rightLimitArrow)) RETURN (  __MKSMALLINT(XC_right_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3423
    if (shape == @symbol(text)) RETURN (  __MKSMALLINT(XC_xterm) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3424
    if (shape == @symbol(upRightArrow)) RETURN (  __MKSMALLINT(XC_draft_large) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3425
    if (shape == @symbol(leftHand)) RETURN (  __MKSMALLINT(XC_hand2) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3426
    if (shape == @symbol(questionMark)) RETURN (  __MKSMALLINT(XC_question_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3427
    if (shape == @symbol(cross)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3428
    if (shape == @symbol(wait)) RETURN (  __MKSMALLINT(XC_watch) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3429
    if (shape == @symbol(crossHair)) RETURN (  __MKSMALLINT(XC_tcross) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3430
    if ((shape == @symbol(origin)) || (shape == @symbol(topLeft))) RETURN (  __MKSMALLINT(XC_ul_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3431
    if ((shape == @symbol(corner)) || (shape == @symbol(bottomRight))) RETURN ( __MKSMALLINT(XC_lr_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3432
    if (shape == @symbol(topRight)) RETURN (  __MKSMALLINT(XC_ur_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3433
    if (shape == @symbol(bottomLeft)) RETURN (  __MKSMALLINT(XC_ll_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3434
    if (shape == @symbol(square)) RETURN (  __MKSMALLINT(XC_dotbox) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3435
    if (shape == @symbol(fourWay)) RETURN (  __MKSMALLINT(XC_fleur) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3436
    if (shape == @symbol(crossCursor)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3437
%}.
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7416
diff changeset
  3438
"/    Logger info:'invalid cursorShape: %1' with:shape.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3439
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3440
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3441
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3442
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3443
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3444
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3445
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3446
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3447
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3448
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3449
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3450
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3451
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3452
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3453
	"/ DND can drop files, file, dir, links, dirLink and text
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3454
	"/ check for this.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3455
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3456
	dropObjects isCollection ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3457
	    dropColl := Array with:dropObjects
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3458
	] ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3459
	    dropColl := dropObjects
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3460
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3461
	anyFile := anyDir := anyText := anyOther := false.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3462
	dropColl do:[:aDropObject |
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3463
	    aDropObject isFileObject ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3464
		aDropObject theObject isDirectory ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3465
		    anyDir := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3466
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3467
		    anyFile := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3468
		]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3469
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3470
		aDropObject isTextObject ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3471
		    anyText := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3472
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3473
		    anyOther := true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3474
		]
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
	anyOther ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3479
	    "/ DND does not support this ...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3480
	    Logger info:'DND can only drop files or text'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3481
	    ^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3482
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3483
	anyText ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3484
	    (anyFile or:[anyDir]) ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3485
		"/ DND does not support mixed types
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3486
		Logger info:'DND cannot drop both files and text'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3487
		^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3488
	    ]
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
	dropCollSize := dropColl size.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3492
	anyFile ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3493
	    dropType := #DndFiles.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3494
	    dropCollSize == 1 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3495
		dropType := #DndFile
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3496
	    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3497
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3498
	    anyDir ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3499
		dropType := #DndFiles.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3500
		dropCollSize == 1 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3501
		    dropType := #DndDir
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3502
		]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3503
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3504
		anyText ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3505
		    dropCollSize == 1 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3506
			dropType := #DndText
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3507
		    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3508
			"/ can only drop a single text object
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3509
			Logger info:'DND can only drop a single text'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3510
			^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3511
		    ]
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3512
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3513
		    "/ mhmh ...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3514
		    Logger info:'DND cannot drop this'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3515
		    ^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3516
		]
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
	dropTypeCode := self dndDropTypes indexOf:dropType.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3521
	dropTypeCode == 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3522
	    Logger info:'DND cannot drop this'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3523
	    ^ false
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3524
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3525
	dropTypeCode := dropTypeCode - 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3526
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
	"/ place the selection inTo the DndSelection property
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3529
	"/ of the rootView ...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3530
	"/ ... need a single string, with 0-terminated parts.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3531
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3532
	strings := OrderedCollection new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3533
	sz := 0.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3534
	dropColl do:[:anObject |
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3535
	    |s o|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3536
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3537
	    o := anObject theObject.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3538
	    anObject isFileObject ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3539
		o := o pathName
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3540
	    ].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3541
	    s := o asString.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3542
	    strings add:s.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3543
	    sz := sz + (s size) + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3544
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3545
	val := String new:sz.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3546
	idx := 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3547
	strings do:[:aString |
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3548
	    |sz|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3549
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3550
	    sz := aString size.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3551
	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3552
	    idx := idx + sz.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3553
	    val at:idx put:(Character value:0).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3554
	    idx := idx + 1
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3555
	].
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
	self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3558
	    setProperty:(self atomIDOf:#DndSelection)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3559
	    type:(self atomIDOf:#STRING)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3560
	    value:val
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3561
	    for:rootId.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3562
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3563
	^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3564
	    sendClientEvent:msgType
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3565
	    format:32
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3566
	    to:destinationId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3567
	    propagate:true
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3568
	    eventMask:nil
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3569
	    window:destinationId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3570
	    data1:dropTypeCode
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3571
	    data2:0
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3572
	    data3:destinationId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3573
	    data4:nil
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3574
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3575
    ].
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
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3578
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3579
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  3580
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3581
!
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
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3584
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3585
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3586
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3587
	    DndUnknown      "/ 0
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3588
	    DndRawData      "/ 1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3589
	    DndFile         "/ 2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3590
	    DndFiles        "/ 3
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3591
	    DndText         "/ 4
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3592
	    DndDir          "/ 5
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3593
	    DndLink         "/ 6
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3594
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3595
       )
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
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3598
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3599
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3600
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3601
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3602
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3603
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3604
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3605
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3606
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3607
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3608
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3609
	^ self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3610
	    dndDrop:aCollectionOfDropObjects
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3611
	    inWindowID:destinationId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3612
	    position:destinationPoint
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3613
	    rootPosition:rootPoint
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3614
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3615
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3616
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3617
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3618
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3619
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3620
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3621
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3622
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3623
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3624
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3625
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
  3626
    "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
  3627
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3628
    <context: #return>
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3629
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3630
    operationsUntilFlush notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3631
	operationsUntilFlush <= 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3632
	    self flush.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3633
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3634
	    operationsUntilFlush := operationsUntilFlush - 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3635
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3636
    ].
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
    int w, h;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3640
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3641
    if (ISCONNECTED
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3642
     && __isExternalAddress(aDrawableId)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3643
     && __bothSmallInteger(x, y)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3644
     && __bothSmallInteger(width, height)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3645
	w = __intVal(width);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3646
	h = __intVal(height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3647
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3648
	 * 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
  3649
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3650
	if ((w >= 0) && (h >= 0)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3651
	    ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3652
	    XClearArea(myDpy,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3653
			   __DrawableVal(aDrawableId),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3654
			   __intVal(x), __intVal(y), w, h, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3655
	    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3656
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3657
	RETURN ( self );
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3658
    }
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
    "badGC, badDrawable or coordinates not integer"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3661
    self primitiveFailedOrClosedConnection
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3662
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3663
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3664
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
  3665
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3666
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3667
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3668
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3669
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3670
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3671
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3672
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3673
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3674
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3675
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3676
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3677
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3678
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3679
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3680
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3681
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3682
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3683
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3684
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3685
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3686
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3687
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3688
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3689
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3690
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3691
	int _sX, _sY, _w, _h, _dX, _dY;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3692
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3693
	_sX = __intVal(srcX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3694
	_sY = __intVal(srcY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3695
	_w = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3696
	_h = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3697
	_dX = __intVal(dstX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3698
	_dY = __intVal(dstY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3699
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3700
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3701
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3702
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3703
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3704
	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3705
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3706
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3707
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3708
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3709
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3710
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3711
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3712
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3713
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3714
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3715
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
  3716
    "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
  3717
     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
  3718
     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
  3719
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3720
     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
  3721
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3722
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3723
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3724
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3725
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3726
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3727
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3728
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3729
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3730
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3731
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3732
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3733
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3734
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3735
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3736
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3737
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3738
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3739
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3740
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3741
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3742
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3743
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3744
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3745
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3746
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3747
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3748
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3749
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3750
	XCopyArea(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3751
				__intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3752
				__intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3753
				__intVal(dstX), __intVal(dstY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3754
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3755
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3756
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3757
    }
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
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3760
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3761
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3762
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3763
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3764
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3765
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
  3766
    "do a bit-blt, but only copy the low-bit plane;
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3767
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3768
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3769
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3770
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3771
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3772
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3773
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3774
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3775
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3776
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3777
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3778
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3779
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3780
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3781
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3782
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3783
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3784
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3785
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3786
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3787
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3788
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3789
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3790
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3791
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3792
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3793
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3794
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3795
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3796
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3797
	XCopyPlane(myDpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3798
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3799
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3800
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3801
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3802
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3803
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3804
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3805
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3806
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3807
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3808
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3809
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3810
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3811
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
  3812
    "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
  3813
     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
  3814
     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
  3815
     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
  3816
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3817
     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
  3818
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3819
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3820
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3821
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3822
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3823
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3824
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3825
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3826
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3827
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3828
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3829
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3830
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3831
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3832
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3833
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3834
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3835
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3836
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3837
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3838
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3839
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3840
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3841
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3842
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3843
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3844
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3845
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3846
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3847
	XCopyPlane(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3848
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3849
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3850
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3851
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3852
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3853
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3854
    }
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
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3857
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3858
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3859
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3860
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3861
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3862
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
  3863
    "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
  3864
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3865
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3866
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3867
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3868
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3869
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3870
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3871
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3872
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3873
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3874
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3875
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3876
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3877
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3878
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3879
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3880
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3881
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3882
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3883
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3884
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3885
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3886
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3887
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3888
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3889
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3890
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3891
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3892
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3893
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3894
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3895
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3896
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3897
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3898
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3899
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3900
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3901
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3902
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3903
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3904
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3905
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3906
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3907
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3908
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3909
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3910
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3911
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3912
	 * 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
  3913
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3914
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3915
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3916
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3917
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3918
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3919
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3920
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3921
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3922
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3923
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3924
    "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
  3925
     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
  3926
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3927
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3928
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3929
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3930
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
  3931
    "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
  3932
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3933
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3934
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3935
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3936
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3937
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3938
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3939
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3940
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3941
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3942
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3943
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3944
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3945
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3946
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3947
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3948
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3949
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3950
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3951
     && __bothSmallInteger(x1, y1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3952
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3953
	int ix0, iy0, ix1, iy1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3954
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3955
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3956
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3957
	ix0 = __intVal(x0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3958
	iy0 = __intVal(y0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3959
	ix1 = __intVal(x1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3960
	iy1 = __intVal(y1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3961
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3962
	/* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3963
	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3964
	else if (ix0 < -0x8000) ix0 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3965
	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3966
	else if (iy0 < -0x8000) iy0 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3967
	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3968
	else if (ix1 < -0x8000) ix1 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3969
	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3970
	else if (iy1 < -0x8000) iy1 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3971
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3972
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3973
	if ((ix0 == ix1) && (iy0 == iy1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3974
	    /* little bit shorter X-lib message (better with slow connections...) */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3975
	    XDrawPoint(dpy, win, gc, ix0, iy0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3976
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3977
	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3978
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3979
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3980
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3981
    }
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
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3984
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3985
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3986
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3987
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
  3988
    "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
  3989
     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
  3990
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3991
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3992
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3993
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3994
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3995
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3996
    (noY := yValues size) < 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3997
	^ self
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3998
    ].
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3999
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4000
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4001
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4002
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4003
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4004
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4005
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4006
    ].
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4007
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4008
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4009
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4010
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4011
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4012
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4013
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4014
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4015
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4016
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4017
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4018
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4019
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4020
     && __isExternalAddress(aDrawableId) ) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4021
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4022
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4023
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4024
	if( __isSmallInteger(scaleY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4025
	    sY = (float) __intVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4026
	else if (__isFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4027
	    sY = __floatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4028
	else if (__isShortFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4029
	    sY = __shortFloatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4030
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4031
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4032
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4033
	    sY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4034
	}
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
	if( __isSmallInteger(transY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4037
	    tY = (float) __intVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4038
	else if (__isFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4039
	    tY = __floatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4040
	else if (__isShortFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4041
	    tY = __shortFloatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4042
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4043
	    t = __SSEND0(transY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4044
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4045
	    tY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4046
	}
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
	if( __isSmallInteger(startX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4049
	    x = (float) __intVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4050
	else if (__isFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4051
	    x = __floatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4052
	else if (__isShortFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4053
	    x = __shortFloatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4054
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4055
	    t = __SSEND0(startX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4056
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4057
	    x = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4058
	}
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
	if( __isSmallInteger(stepX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4061
	    step = (float) __intVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4062
	else if (__isFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4063
	    step = __floatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4064
	else if (__isShortFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4065
	    step = __shortFloatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4066
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4067
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4068
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4069
	    step = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4070
	}
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
	num = __intVal( noY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4073
	if( num > 200 ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4074
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4075
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4076
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4077
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4078
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4079
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4080
	for( i = 0; i < num; ++i ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4081
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4082
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4083
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4084
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4085
	    if( __isFloat(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4086
		y = __floatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4087
	    else if( __isSmallInteger(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4088
		y = (float) __intVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4089
	    else if( __isShortFloat( yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4090
		y = __shortFloatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4091
	    else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4092
		t = __SSEND0(yA, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4093
		if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4094
		y = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4095
	    }
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
	    px = (int) (x + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4098
	    py = (int) ((y * sY) + tY + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4099
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4100
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4101
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4102
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4103
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4104
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4105
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4106
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4107
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4108
	    x = x + step;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4109
	}
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4112
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4113
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4114
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4115
	if( mustFree ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4116
	    free( points );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4117
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4118
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4119
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4120
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4121
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4122
    if( mustFree )
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4123
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4124
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4125
    ^ 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
  4126
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  4127
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4128
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4129
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4130
displayPointX:x y:y in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4131
    "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
  4132
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4133
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4134
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4135
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4136
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4137
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4138
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4139
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4140
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4141
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4142
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4143
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4144
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4145
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4146
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4147
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4148
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4149
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4150
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4151
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4152
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4153
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4154
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4155
	px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4156
	py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4157
	if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4158
	else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4159
	if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4160
	else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4161
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4162
	XDrawPoint(myDpy, win, gc, px, py);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4163
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4164
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4165
    }
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
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4168
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4169
!
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
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4172
    "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
  4173
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4174
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4175
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4176
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4177
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4178
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4179
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4180
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4181
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4182
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4183
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4184
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4185
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4186
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4187
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4188
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4189
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4190
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4191
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4192
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4193
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4194
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4195
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4196
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4197
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4198
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4199
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4200
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4201
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4202
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4203
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4204
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4205
	 * avoid a (slow) malloc, if the number of points is small
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4206
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4207
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4208
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4209
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4210
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4211
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4212
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4213
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4214
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4215
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4216
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4217
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4218
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4219
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4220
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4221
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4222
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4223
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4224
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4225
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4226
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4227
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4228
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4229
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4230
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4231
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4232
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4233
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4234
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4235
	}
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4238
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4239
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4240
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4241
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4242
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4243
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4244
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4245
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4246
    if (mustFree)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4247
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4248
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4249
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4250
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4251
!
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
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
  4254
    "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
  4255
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4256
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4257
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4258
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4259
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4260
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4261
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4262
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4263
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4264
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4265
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4266
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4267
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4268
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4269
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4270
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4271
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4272
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4273
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4274
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4275
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4276
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4277
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4278
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4279
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4280
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4281
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4282
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
	 * 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
  4285
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4286
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4287
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4288
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4289
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4290
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4291
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4292
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4293
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4294
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4295
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4296
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4297
	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4298
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4299
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4300
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4301
    }
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
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4304
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4305
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4306
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4307
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
  4308
    "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
  4309
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4310
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4311
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4312
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4313
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4314
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4315
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4316
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4317
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4318
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4319
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4320
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4321
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4322
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4323
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4324
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4325
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4326
    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
  4327
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4328
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4329
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4330
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4331
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4332
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4333
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4334
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4335
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4336
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4337
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4338
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4339
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4340
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4341
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4342
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4343
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4344
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4345
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4346
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4347
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4348
		RETURN (self);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4349
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4350
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4351
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4352
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4353
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4354
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4355
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4356
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4357
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4358
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4359
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4360
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4361
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4362
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4363
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4364
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4365
		}
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
	    cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4369
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4370
	    cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4371
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4372
	    if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4373
		n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4374
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4375
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4376
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4377
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4378
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4379
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4380
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4381
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4382
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4383
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4384
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4385
		}
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
	    /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4389
	    if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4390
		n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4391
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4392
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4393
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4394
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4395
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4396
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4397
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4398
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4399
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4400
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4401
		    if (l > lMax) l = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4402
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4403
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4404
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4405
		     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4406
		     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4407
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4408
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4409
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4410
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4411
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4412
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4413
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4414
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4415
		    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4416
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4417
		    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4418
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4419
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4420
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4421
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4422
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4423
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4424
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4425
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4426
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4427
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4428
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4429
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4430
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4431
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4432
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4433
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4434
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4435
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4436
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4437
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4438
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4439
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4440
		    }
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
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4443
		}
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
	    /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4447
	    if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4448
		n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4449
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4450
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4451
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4452
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4453
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4454
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4455
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4456
		    int32 *ip;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4457
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4458
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4459
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4460
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4461
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
		     * 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
  4464
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4465
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4466
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4467
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4468
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4469
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4470
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4471
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4472
			int32 codePoint = ((int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4473
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4474
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4475
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4476
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4477
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4478
			cp2[i].byte2 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4479
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4480
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4481
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4482
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4483
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4484
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4485
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4486
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4487
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4488
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4489
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4490
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4491
		    }
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
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4494
		}
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
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4497
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4498
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4499
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4500
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4501
	self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4502
	     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
  4503
	^ self.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4504
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4505
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4506
    "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
  4507
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4508
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4509
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4510
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
  4511
    "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
  4512
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4513
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4514
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4515
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4516
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4517
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4518
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4519
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4520
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4521
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4522
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4523
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4524
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4525
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4526
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4527
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4528
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4529
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4530
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4531
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4532
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4533
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4534
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4535
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4536
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4537
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4538
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4539
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4540
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4541
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4542
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4543
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4544
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4545
	cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4546
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4547
	if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4548
	    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4549
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4550
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4551
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4552
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4553
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4554
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4555
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4556
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4557
	}
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
	cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4560
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4561
	cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4562
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4563
	if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4564
	    n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4565
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4566
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4567
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4568
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4569
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4570
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4571
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4572
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4573
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4574
	}
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
	/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4577
	if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4578
	    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4579
		char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4580
		unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4581
	    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4582
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4583
	    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4584
	    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4585
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4586
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4587
	    if (n > lMax) n = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4588
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4589
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4590
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4591
	     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4592
	     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4593
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4594
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4595
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4596
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4597
	     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4598
	     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4599
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4600
	    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4601
	    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4602
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4603
	    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4604
		if (n <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4605
		    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4606
		} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4607
		    cp2 = (XChar2b *)(malloc(n * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4608
		    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4609
		}
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
		for (i=0; i<n; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4612
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4613
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4614
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4615
		cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4616
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4617
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4618
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4619
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4620
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4621
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4622
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4623
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4624
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4625
	    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4626
		free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4627
	    }
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
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4630
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4631
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4632
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4633
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4634
    ^ 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
  4635
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4636
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4637
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4638
        width:imageWidth height:imageHeight
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4639
        x:srcx y:srcy
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4640
        into:aDrawableId
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4641
        x:dstx y:dsty
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4642
        width:w height:h
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4643
        with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4644
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4645
    "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
  4646
     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
  4647
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4648
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4649
     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
  4650
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4651
     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
  4652
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4653
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4654
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4655
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4656
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4657
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4658
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4659
    "/ 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
  4660
    "/ 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
  4661
    "/ 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
  4662
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4663
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4664
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4665
        fmt := self supportedImageFormatForDepth:4.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4666
        fmt isNil ifTrue:[
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4667
            self primitiveFailed. "/ cannot represent this image
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4668
            ^ nil
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4669
        ].
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4670
        wantedPadding := fmt at:#padding.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4671
        wantedPadding > givenPadding ifTrue:[
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4672
            bits := self
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4673
                            repadBits:givenBits
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4674
                            width:imageWidth
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4675
                            height:imageHeight
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4676
                            depth:imageDepth
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4677
                            from:givenPadding
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4678
                            to:wantedPadding.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4679
            padding := wantedPadding.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4680
        ]
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4681
    ].
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4682
    
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4683
    self 
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4684
        drawBits:bits 
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4685
        msb:true bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4686
        width:imageWidth height:imageHeight
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4687
        x:srcx y:srcy
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4688
        into:aDrawableId
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4689
        x:dstx y:dsty
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4690
        width:w height:h
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4691
        with:aGCId
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4692
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4693
    "Modified: / 11-04-2017 / 18:50:32 / cg"
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4694
!
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
drawBits:bits msb:msb bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4697
        width:imageWidth height:imageHeight
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4698
        x:srcx y:srcy
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4699
        into:aDrawableId
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4700
        x:dstx y:dsty
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4701
        width:w height:h
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4702
        with:aGCId
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4703
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4704
    "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
  4705
     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
  4706
     Individual source pixels have bitsPerPixel bits, allowing to draw
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4707
     depth and pixel-units to be different.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4708
     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
  4709
     depth - otherwise, primitive failure will be signalled.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4710
     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
  4711
     colors are allocated - otherwise the colors may be wrong."
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4712
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4713
    operationsUntilFlush notNil ifTrue:[
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4714
        operationsUntilFlush <= 0 ifTrue:[
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4715
            self flush.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4716
        ] ifFalse:[
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4717
            operationsUntilFlush := operationsUntilFlush - 1.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4718
        ].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4719
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4720
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4721
     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
  4722
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4723
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4724
    (self
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4725
        primDrawBits:bits
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4726
        bitsPerPixel:bitsPerPixel
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4727
        depth:imageDepth
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4728
        msb:msb
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4729
        padding:padding
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4730
        width:imageWidth height:imageHeight
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4731
        x:srcx y:srcy
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4732
        into:aDrawableId
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4733
        x:dstx y:dsty
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4734
        width:w height:h
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4735
        with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4736
    ifFalse:[
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4737
        "
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4738
         also happens, if a segmentation violation occurs in the
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4739
         XPutImage ...
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4740
        "
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4741
        self primitiveFailedOrClosedConnection
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4742
    ].
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
    "Created: / 11-04-2017 / 18:49:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4745
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4746
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  4747
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
  4748
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4749
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4750
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4751
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4752
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4753
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4754
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4755
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4756
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4757
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4758
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4759
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4760
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4761
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4762
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4763
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4764
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4765
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4766
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4767
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4768
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4769
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4770
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4771
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4772
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4773
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4774
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4775
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4776
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4777
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4778
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4779
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4780
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4781
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4782
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4783
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4784
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4785
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4786
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4787
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4788
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4789
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4790
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4791
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4792
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4793
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4794
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4795
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4796
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4797
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4798
	 * 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
  4799
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4800
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4801
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4802
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4803
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4804
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4805
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4806
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4807
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4808
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4809
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4810
    "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
  4811
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4812
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4813
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4814
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4815
48194c26a46c Initial revision
claus
parents:
diff changeset
  4816
fillPolygon:aPolygon in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4817
    "fill a polygon given by its points.
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4818
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4819
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4820
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4821
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4822
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4823
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4824
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4825
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4826
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4827
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4828
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4829
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4830
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4831
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  4832
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4833
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4834
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4835
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4836
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4837
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4838
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4839
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4840
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4841
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4842
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4843
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4844
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4845
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4846
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4847
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4848
	if (num < 3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4849
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4850
	}
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
	 * avoid (slow) malloc, if not many points
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4853
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4854
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4855
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4856
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4857
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4858
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4859
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4860
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4861
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4862
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4863
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4864
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4865
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4866
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4867
	    points[i].x = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4868
	    points[i].y = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4869
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4870
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4871
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4872
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4873
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4874
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4875
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4876
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4877
fail: ;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4878
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4879
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4880
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4881
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4882
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4883
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4884
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4885
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4886
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
  4887
    "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
  4888
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4889
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4890
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4891
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4892
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4893
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4894
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4895
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4896
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4897
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4898
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4899
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4900
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4901
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4902
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4903
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4904
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4905
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4906
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4907
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4908
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4909
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4910
	 * 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
  4911
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4912
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4913
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4914
	    XFillRectangle(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4915
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4916
			   __intVal(x), __intVal(y), w, h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4917
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4918
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4919
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4920
    }
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
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4923
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4924
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4925
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4926
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4927
			     extent:imageExtent sourceOrigin:srcOrg
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4928
			       into:aDrawableId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4929
		  destinationOrigin:dstOrg extent:dstExtent
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4930
			       with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4931
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4932
    <context: #return>
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
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
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 := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4937
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4938
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4939
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4940
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4941
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4942
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4943
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4944
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4945
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4946
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4947
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4948
    "since XPutImage may allocate huge amount of stack space
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4949
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4950
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4951
%{  /* UNLIMITEDSTACK */
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
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4954
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4955
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4956
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4957
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4958
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4959
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4960
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4961
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4962
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4963
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4964
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4965
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4966
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4967
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4968
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4969
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4970
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4971
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4972
     && __isSmallInteger(bm)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4973
     && __isByteArrayLike(imageBits)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4974
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4975
	int pad = __intVal(bitPadding);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4976
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4977
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4978
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4979
	if (! gc || !win)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4980
	    goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4981
#ifdef ARGDEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4982
	console_printf("args ok\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4983
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4984
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4985
	image.width = imgWdth = __intVal(imageWidth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4986
	image.height = __intVal(imageHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4987
	image.xoffset = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4988
	image.format = ZPixmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4989
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4990
	image.bitmap_unit = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4991
	image.bitmap_bit_order = MSBFirst;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4992
	image.bitmap_pad = pad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4993
	image.depth = __intVal(imageDepth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4994
	image.bits_per_pixel = __intVal(bitsPerPixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4995
	image.red_mask = __intVal(rm);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4996
	image.green_mask = __intVal(gm);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4997
	image.blue_mask = __intVal(bm);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4998
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4999
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5000
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5001
	switch (image.bits_per_pixel) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5002
	    case 1:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5003
	    case 2:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5004
	    case 4:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5005
	    case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5006
	    case 16:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5007
	    case 24:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5008
	    case 32:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5009
		break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5010
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5011
	    default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5012
#ifdef ARGDEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5013
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5014
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5015
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5016
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5017
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5018
	/* ENTER_XLIB(); */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5019
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5020
					__intVal(dstx), __intVal(dsty),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5021
					__intVal(w), __intVal(h));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5022
	/* LEAVE_XLIB(); */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5023
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5024
	RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5025
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5026
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5027
    if (!! __isExternalAddress(aGCId)) console_printf("GC\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5028
    if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5029
    if (!! __isSmallInteger(srcx)) console_printf("srcx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5030
    if (!! __isSmallInteger(srcy)) console_printf("srcy\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5031
    if (!! __isSmallInteger(dstx)) console_printf("dstx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5032
    if (!! __isSmallInteger(dsty)) console_printf("dsty\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5033
    if (!! __isSmallInteger(w)) console_printf("w\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5034
    if (!! __isSmallInteger(h)) console_printf("h\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5035
    if (!! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5036
    if (!! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5037
    if (!! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5038
    if (!! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5039
    if (!! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5040
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5041
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5042
fail: ;
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
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5045
    ^ false
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
3608
6ac2b6c8fbd8 primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents: 3603
diff changeset
  5048
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5049
			      width:imageWidth height:imageHeight
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5050
				  x:srcx y:srcy
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5051
			       into:aDrawableId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5052
				  x:dstx y:dsty
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5053
			      width:w height:h
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5054
			       with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5055
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5056
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5057
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5058
    "since XPutImage may allocate huge amount of stack space
132
claus
parents: 129
diff changeset
  5059
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  5060
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5061
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5062
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5063
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5064
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5065
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5066
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5067
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5068
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5069
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  5070
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5071
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5072
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5073
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5074
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5075
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5076
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5077
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5078
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5079
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  5080
     && __isSmallInteger(bitPadding)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5081
     && __isByteArrayLike(imageBits)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5082
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5083
	int pad = __intVal(bitPadding);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5084
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5085
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5086
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5087
	if (! gc || !win)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5088
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5089
#ifdef ARGDEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5090
	console_printf("args ok\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5091
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5092
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5093
	image.width = imgWdth = __intVal(imageWidth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5094
	image.height = __intVal(imageHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5095
	image.xoffset = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5096
	image.format = ZPixmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5097
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5098
	image.bitmap_unit = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5099
	image.bitmap_bit_order = MSBFirst;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5100
	image.bitmap_pad = pad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5101
	image.depth = __intVal(imageDepth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5102
	image.bits_per_pixel = __intVal(bitsPerPixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5103
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5104
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5105
	image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5106
	*/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5107
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5108
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5109
	switch (image.bits_per_pixel) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5110
	    case 1:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5111
	    case 2:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5112
	    case 4:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5113
	    case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5114
	    case 16:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5115
	    case 24:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5116
	    case 32:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5117
		break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5118
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5119
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5120
#ifdef ARGDEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5121
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5122
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5123
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5124
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5125
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5126
	image.red_mask = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5127
	image.green_mask = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5128
	image.blue_mask = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5129
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5130
	/* ENTER_XLIB(); */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5131
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5132
					__intVal(dstx), __intVal(dsty),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5133
					__intVal(w), __intVal(h));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5134
	/* LEAVE_XLIB(); */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5135
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5136
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5137
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5138
#ifdef ARGDEBUG
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5139
    if (!! __isExternalAddress(aGCId)) console_printf("GC\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5140
    if (!! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5141
    if (!! __isSmallInteger(srcx)) console_printf("srcx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5142
    if (!! __isSmallInteger(srcy)) console_printf("srcy\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5143
    if (!! __isSmallInteger(dstx)) console_printf("dstx\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5144
    if (!! __isSmallInteger(dsty)) console_printf("dsty\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5145
    if (!! __isSmallInteger(w)) console_printf("w\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5146
    if (!! __isSmallInteger(h)) console_printf("h\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5147
    if (!! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5148
    if (!! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5149
    if (!! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
  5150
    if (!! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5151
    if (!! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5152
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5153
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5154
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5155
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  5156
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5157
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5158
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  5159
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5160
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5161
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5162
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
  5163
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5164
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5165
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5166
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5167
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5168
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5169
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
  5170
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5171
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5172
    |logicalButton clickPosition|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5173
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5174
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5175
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5176
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5177
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5178
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5179
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5180
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5181
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5182
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5183
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5184
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  5185
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  5186
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  5187
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5188
      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
  5189
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5190
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5191
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5192
    logicalButton isInteger ifTrue:[
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5193
        buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5194
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5195
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5196
    clickPosition := x @ y.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5197
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5198
    (multiClickTimeDelta notNil 
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5199
     and:[lastButtonPressTime notNil
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5200
     and:[time < (lastButtonPressTime + multiClickTimeDelta)
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5201
     and:[(clickPosition dist:lastButtonPressPosition) < 6]]]) ifTrue:[
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5202
        lastButtonPressTime := time.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5203
        lastButtonPressPosition := clickPosition.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5204
        self buttonMultiPress:logicalButton x:x y:y view:view.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5205
        ^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5206
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5207
    lastButtonPressTime := time.
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5208
    lastButtonPressPosition := clickPosition.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5209
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5210
    view isNil ifTrue:[
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5211
        "/ event arrived, after I destroyed it myself
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5212
        ^ self
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5213
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5214
    (logicalButton == 1 and:[activateOnClick == true]) ifTrue:[
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5215
        "/ don't raise above an active popup view.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5216
        (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5217
            view topView raise.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5218
        ]
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5219
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5220
    self buttonPress:logicalButton x:x y:y view:view
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5221
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5222
    "Modified: / 09-05-2017 / 10:33:01 / stefan"
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5223
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5224
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5225
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
  5226
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5227
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5228
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5229
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5230
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5231
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5232
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5233
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5234
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5235
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5236
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5237
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5238
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5239
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5240
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5241
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5242
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5243
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5244
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5245
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5246
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5247
    logicalButton isInteger ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5248
	buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5249
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5250
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5251
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5252
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5253
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5254
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5255
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5256
    targetView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5257
	"targetView is gone? Anyway, cannot do anything with this event..."
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5258
	^ self.
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5259
    ].
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5260
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5261
    "DND drag&drop protocol"
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5262
    (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5263
	self dndMessage:nil data:data view:targetView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5264
	^ self.
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5265
    ].
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5266
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5267
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5268
    "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
  5269
    sensor notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5270
	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
  5271
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5272
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5273
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5274
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5275
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5276
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
  5277
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5278
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5279
"/    anotherViewId notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5280
"/        |parentViewOrSelf|
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5281
"/        parentViewOrSelf := self viewFromId:anotherViewId.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5282
"/        parentViewOrSelf notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5283
"/        ].
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5284
"/     ].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5285
    self configureX:x y:y width:w height:h view:view.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5286
    aboveViewId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5287
	|aboveView|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5288
	aboveView := self viewFromId:aboveViewId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5289
	aboveView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5290
	    "view is now on the top of the window stack"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5291
	    self coveredBy:view view:aboveView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5292
	].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5293
     ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5294
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5295
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5296
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
  5297
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5298
    view isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5299
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5300
	^ self
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5301
    ].
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5302
    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
  5303
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5304
    "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
  5305
    "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
  5306
!
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5307
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5308
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
  5309
    "handle a drag&drop protocol message"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5310
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5311
    |sensor property dropType dropValue names i1 i2 propertyType|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5312
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5313
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5314
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5315
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5316
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
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
    property := self
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5319
	getProperty:(self atomIDOf:#DndSelection)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5320
	from:rootId
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5321
	delete:false.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5322
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5323
    propertyType := property key.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5324
    dropValue := property value.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5325
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5326
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5327
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5328
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5329
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5330
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5331
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5332
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5333
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5334
    dropType == #DndFiles ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5335
	"/ actually, a list of fileNames
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5336
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5337
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5338
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5339
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5340
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5341
	names := OrderedCollection new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5342
	i1 := 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5343
	[i1 ~~ 0] whileTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5344
	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5345
	    i2 ~~ 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5346
		names add:(dropValue copyFrom:i1 to:(i2-1)).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5347
		i1 := i2 + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5348
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5349
		i1 := i2
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5350
	    ].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5351
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5352
	dropValue := names.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5353
	dropValue := dropValue collect:[:nm | nm asFilename].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5354
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5355
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5356
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5357
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5358
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5359
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5360
	dropValue := dropValue asFilename.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5361
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5362
    ] ifFalse:[ (dropType == #DndDir) 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 := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5369
    ] ifFalse:[ (dropType == #DndText) 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
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5375
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5376
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5377
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5378
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5379
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5380
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5381
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5382
	propertyType ~~ stringAtom ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5383
	    Logger info:'expected a string propertyValue in drop'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5384
	    ^ self
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5385
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5386
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5387
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5388
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  5389
    ] ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5390
	Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5391
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5392
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5393
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5394
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5395
    "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
  5396
    sensor notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  5397
	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
  5398
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5399
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5400
    "Created: 4.4.1997 / 17:59:37 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5401
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5402
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5403
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
  5404
    "forward an expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5405
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5406
    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
  5407
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5408
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5409
focusIn:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5410
    "a view got the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5411
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5412
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5413
	"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
  5414
	self focusInView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5415
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5416
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5417
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5418
focusOut:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5419
    "a view lost the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5420
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5421
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5422
	"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
  5423
	self focusOutView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5424
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5425
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5426
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5427
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
  5428
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5429
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5430
    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
  5431
!
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
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
  5434
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5435
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5436
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5437
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5438
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5439
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5440
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5441
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5442
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5443
    key isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5444
	"/ happens sometimes on some systems
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5445
	"/ (alt-graph on sun has no keysym)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5446
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5447
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5448
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5449
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5450
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5451
    "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
  5452
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5453
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5454
    self keyPress:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5455
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5456
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5457
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
  5458
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5459
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5460
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5461
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5462
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5463
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5464
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5465
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5466
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5467
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5468
    key isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5469
	"/ happens sometimes on some systems
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5470
	"/ (alt-graph on sun has no keysym)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5471
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5472
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5473
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5474
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5475
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5476
    "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
  5477
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5478
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5479
    self keyRelease:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5480
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5481
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5482
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5483
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5484
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5485
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5486
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5487
	self refreshKeyboardMapping:eB.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5488
	"Maybe some of our modifiers have been changed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5489
	self initializeModifierMappings.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5490
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5491
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5492
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5493
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5494
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
  5495
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5496
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5497
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5498
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5499
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5500
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5501
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5502
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5503
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5504
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5505
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5506
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5507
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5508
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
  5509
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5510
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5511
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5512
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5513
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5514
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5515
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5516
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5517
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5518
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5519
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5520
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5521
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5522
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
  5523
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5524
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5525
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5526
    |selectionFetcher|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5527
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5528
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5529
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5530
	"event arrived, after aView has been destroyed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5531
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5532
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5533
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5534
"/    '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
  5535
"/    aView propertyChange:atom state:aSymbol.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5536
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5537
    "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
  5538
     be interested (for now, only XEmbedSiteView is)"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5539
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5540
    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
  5541
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5542
    aSymbol ~~ #newValue ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5543
	"I am not interested in delete notifications"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5544
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5545
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5546
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5547
    selectionFetcher notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5548
	selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5549
    ].
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5550
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5551
    "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
  5552
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5553
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5554
selectionClear:aView selection:selectionID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5555
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5556
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5557
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5558
    |selectionFetcher|
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5559
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5560
    lastEventTime := time.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5561
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5562
    selectionHandlers notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5563
	selectionHandlers do:[:eachHandler |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5564
	    eachHandler selectionClear:selectionID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5565
	]
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5566
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5567
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5568
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5569
	"event arrived, after aView has been destroyed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5570
	^ self
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5571
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5572
    selectionFetcher := self findSelectionFetcher:aView id.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5573
    selectionFetcher notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5574
	selectionFetcher message:thisContext message.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5575
    ].
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5576
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5577
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5578
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
  5579
    "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
  5580
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5581
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5582
    |selectionFetcher|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5583
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5584
"/    Transcript show:'selectionNotify selID:'.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5585
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5586
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5587
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5588
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5589
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5590
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5591
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5592
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5593
    lastEventTime := time.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5594
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5595
    aView isNil ifTrue:[
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5596
        "event arrived, after aView has been destroyed"
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5597
        ^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5598
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5599
    selectionFetcher := self findSelectionFetcher:aView id.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5600
    selectionFetcher notNil ifTrue:[
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5601
        selectionFetcher message:thisContext message.
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5602
    ].
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5603
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5604
    "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
  5605
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5606
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5607
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5608
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5609
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5610
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5611
    |selection property bufferGetSelector responseTargetID selectionTime|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5612
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5613
"/'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5614
"/' Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5615
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5616
    lastEventTime := time.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5617
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5618
    "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
  5619
    selectionID == primaryAtom ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5620
	bufferGetSelector := #getPrimaryBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5621
	selectionTime := primarySelectionTime.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5622
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5623
	bufferGetSelector := #getCopyBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5624
	selectionTime := clipboardSelectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5625
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5626
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5627
    (targetID == (self atomIDOf:#TIMESTAMP)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5628
	"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
  5629
	responseTargetID := self atomIDOf:#INTEGER.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5630
	selection := selectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5631
    ] ifFalse:[(targetID == (self atomIDOf:#TARGETS)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5632
	"the other view wants to know which targets we support"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5633
	responseTargetID := self atomIDOf:#ATOM.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5634
	selection := self supportedTargetAtoms.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5635
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5636
	selection := self selectionBuffer:bufferGetSelector as:targetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5637
	responseTargetID := selection key.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5638
	selection := selection value.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5639
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5640
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5641
"/'Send selection: ' print. selection printCR.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5642
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5643
    property := propertyID.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5644
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5645
    selection isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5646
	"sending property None tells the client,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5647
	 that I could not convert"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5648
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5649
	property := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5650
	responseTargetID := targetID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5651
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5652
	property == 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5653
	    "Support old (obsolete) clients requesting a None property.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5654
	     Set the propertyID to the targetID"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5655
	    property := responseTargetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5656
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5657
	self setProperty:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5658
	     type:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5659
	     value:selection
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5660
	     for:requestorID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5661
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5662
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5663
    self sendNotifySelection:selectionID
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5664
	 property:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5665
	 target:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5666
	 time:time
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5667
	 to:requestorID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5668
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5669
    "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
  5670
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5671
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5672
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5673
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5674
    aView notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5675
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5676
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5677
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5678
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  5679
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5680
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5681
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5682
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5683
     ignored for now."
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
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5686
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5687
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5688
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5689
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5690
!
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
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5693
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5694
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5695
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5696
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5697
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5698
	^ self
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5699
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5700
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5701
    "/ aView colorMapChange
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
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5704
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
  5705
    "ignored for now"
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
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5708
!
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
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5711
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5712
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5713
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5714
!
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
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5717
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5718
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
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5721
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5722
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5723
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5724
    "/ aView mapRequest
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
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5727
reparentedView:aView parentId:parentId x:x y:y
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5728
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5729
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5730
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5731
!
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
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5734
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5735
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5736
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5737
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5738
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  5739
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5740
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5741
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5742
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5743
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5744
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5745
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5746
			 KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5747
			 PointerMotionMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5748
			 EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5749
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5750
			 PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5751
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5752
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5753
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5754
dispatchEvent:evArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5755
    "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
  5756
     to a message send here.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5757
     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
  5758
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5759
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5760
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5761
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5762
    viewId notNil ifTrue:[
7959
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5763
        viewId = lastId ifTrue:[
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5764
            view := lastView
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5765
        ] ifFalse:[
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5766
            view := self viewFromId:viewId
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5767
        ].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5768
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5769
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5770
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5771
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5772
    (self respondsTo:evType) ifTrue:[
7959
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5773
        arguments := evArray copyFrom:3 to:(3 + evType argumentCount - 1).
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5774
        arguments at:1 put:view.
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5775
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5776
        self perform:evType withArguments:arguments.
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5777
        ^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5778
    ].
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5779
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5780
    '********** unhandled event:' errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5781
    evType errorPrintCR. (evArray at:2) errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5782
    '********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5783
    ^ false
7959
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5784
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5785
    "Modified: / 23-02-2017 / 19:57:57 / mawalch"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5786
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5787
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5788
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5789
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5790
     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
  5791
     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
  5792
     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
  5793
     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
  5794
     handled.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5795
     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
  5796
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5797
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5798
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5799
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5800
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5801
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5802
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5803
	AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5804
	    ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5805
	] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5806
	    self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5807
	]
3798
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
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5810
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5811
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5812
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5813
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5814
    "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
  5815
     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
  5816
     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
  5817
     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
  5818
	      pending event before calling this."
3798
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
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5821
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5822
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5823
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5824
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5825
dispatchLoop
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5826
    preWaitAction := [self flush].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5827
    Processor addPreWaitAction:preWaitAction.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5828
    [
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5829
	super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  5830
    ] ensure:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5831
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5832
	preWaitAction := nil.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5833
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5834
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5835
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5836
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5837
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5838
     (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
  5839
     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
  5840
     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
  5841
     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
  5842
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5843
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5844
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5845
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5846
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5847
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5848
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5849
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5850
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5851
	    self dispatchExposeEventFor:dispatchingExpose
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5852
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5853
	^ self
6032
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  5854
    ].
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  5855
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5856
    [self eventPendingWithSync:false] whileTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5857
	eventArray isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5858
	    eventArray := Array new:13.
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 getEventFor:nil withMask:nil into:eventArray) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5861
	    AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5862
		ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5863
	    ] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5864
		self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5865
		"/ multi-screen config: give others a chance
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5866
		"/ (needed because we run at high (non-timesliced) prio)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5867
		Processor yield.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5868
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5869
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5870
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5871
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5872
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5873
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5874
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5875
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5876
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5877
     events matching the mask are thrown away regardless of which
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5878
     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
  5879
     view are flushed."
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
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  5882
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5883
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5884
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5885
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5886
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5887
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5888
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5889
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5890
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5891
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5892
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5893
	    win = __WindowVal(aWindowIdOrNil);
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  5894
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  5895
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5896
	} else {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  5897
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  5898
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5899
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5900
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5901
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5902
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5903
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5904
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5905
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5906
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5907
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5908
    "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
  5909
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5910
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5911
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5912
    int m = 0;
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
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5915
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5916
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5917
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5918
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5919
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5920
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5921
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5922
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5923
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5924
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5925
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5926
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5927
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5928
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5929
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5930
    else if (anEventSymbol == @symbol(substructureNotify)) m = SubstructureNotifyMask;
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5931
    else if (anEventSymbol == @symbol(substructureRedirect)) m = SubstructureRedirectMask;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5932
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5933
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5934
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5935
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5936
eventPending
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5937
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5938
     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
  5939
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5940
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5941
    "/ 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
  5942
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5943
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5944
    dispatchingExpose notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  5945
	^ self exposeEventPendingFor:dispatchingExpose withSync:ConservativeSync
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  5946
    ].
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  5947
    ^ self eventPendingWithSync:ConservativeSync
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5948
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5949
    "Modified: / 28.4.1999 / 11:08:12 / cg"
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
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5952
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5953
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5954
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5955
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5956
!
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
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5959
    "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
  5960
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5961
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5962
%{  /* UNLIMITEDSTACK */
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
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5965
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5966
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5967
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5968
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5969
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5970
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5971
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5972
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5973
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5974
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5975
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5976
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5977
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5978
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5979
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5980
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5981
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5982
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5983
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5984
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5985
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5986
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5987
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5988
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5989
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5990
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5991
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5992
eventPendingWithSync:doSync
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5993
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5994
     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
  5995
     before checking."
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
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5998
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5999
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6000
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6001
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6002
	Display *dpy = myDpy;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6003
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6004
	if (XEventsQueued(dpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6005
	    RETURN (true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6006
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6007
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6008
	ENTER_XLIB();
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6009
	if (doSync == true) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6010
	    XSync(dpy, 0);      /* make certain everything is flushed */
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6011
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6012
	if (XEventsQueued(dpy, QueuedAfterFlush)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6013
	    rslt = true;
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
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6016
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6017
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6018
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6019
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6020
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6021
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6022
    "return true, if any event is queued"
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
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6025
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
3319
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
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6028
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6029
    "Created: 12.12.1995 / 21:43:00 / stefan"
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
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6032
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6033
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6034
     (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
  6035
      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
  6036
      the display connection)."
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
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6039
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6040
	if (XEventsQueued(myDpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6041
	    RETURN(true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6042
	}
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6043
    }
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6044
    RETURN ( false );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6045
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6046
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6047
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6048
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6049
    "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
  6050
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6051
     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
  6052
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6053
    <context: #return>
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
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6056
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6057
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6058
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6059
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6060
    OBJ rslt = false;
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
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6063
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6064
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6065
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6066
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6067
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6068
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6069
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6070
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6071
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6072
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6073
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6074
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6075
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6076
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6077
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6078
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6079
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6080
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6081
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6082
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6083
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6084
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6085
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6086
    "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
  6087
     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
  6088
     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
  6089
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6090
     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
  6091
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6092
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6093
     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
  6094
     the fields are:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6095
	1:      windowID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6096
	2:      eventType-ID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6097
	3:      eventTypeSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6098
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6099
	4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6100
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  6101
     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
  6102
     handler method to allow UNLIMITEDSTACK here.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6103
     (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
  6104
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6105
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6106
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6107
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6108
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6109
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6110
    Window win, wWanted;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6111
    int evMask, returnValue;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6112
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6113
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6114
    KeySym keySym;
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6115
    unsigned char buffer[64];
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6116
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6117
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6118
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6119
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6120
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6121
	RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6122
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6123
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6124
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6125
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6126
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6127
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6128
    if (__isSmallInteger(eventMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6129
	evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6130
    } else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6131
	evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6132
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6133
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6134
    if (__isExternalAddress(aViewIdOrNil)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6135
	wWanted = __WindowVal(aViewIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6136
	returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6137
    } else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6138
	if (evMask == ~0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6139
	    XNextEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6140
	    returnValue = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6141
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6142
	    returnValue = XCheckMaskEvent(dpy, evMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6143
	}
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6144
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6145
    if (!returnValue) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6146
	/* there is no event */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6147
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6148
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6149
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6150
    if (anEventArray == nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6151
	/* sender is not interested in the event */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6152
	RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6153
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6154
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6155
    if (!__isArray(anEventArray)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6156
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6157
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6158
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6159
    if (__arraySize(anEventArray) < 11) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6160
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6161
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6162
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6163
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6164
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
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
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6167
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6168
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6169
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6170
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6171
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6172
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6173
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6174
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6175
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6176
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6177
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6178
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6179
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6180
#   define rr ((XResizeRequestEvent *)&ev)
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6181
#   define rpe ((XReparentEvent *)&ev)
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6182
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6183
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6184
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6185
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6186
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6187
    if (((t = __INST(lastId)) != nil)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6188
	 && __isExternalAddress(t)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6189
	 && (__WindowVal(t) == ae->window)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6190
	windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6191
    } else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6192
	windowID = __MKEXTERNALADDRESS(ae->window);
3798
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
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6195
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6196
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6197
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6198
    switch (ev.type) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6199
	case KeyRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6200
	    sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6201
	    goto keyPressAndRelease;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6202
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6203
	case KeyPress:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6204
	    sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6205
	    /* FALL INTO */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6206
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6207
	keyPressAndRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6208
	    arg = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6209
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6210
	    if (nchars == 1 && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6211
		|| (buffer[0] >= 0x80))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6212
		arg = __MKCHARACTER(buffer[0]);
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6213
//            } else if (nchars > 2) {
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6214
//                arg = __MKSTRING_L(buffer, nchars);
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6215
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6216
		keySymString = XKeysymToString(keySym);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6217
		if (keySymString) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6218
		    arg = __MKSYMBOL(keySymString, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6219
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6220
	    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6221
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6222
#ifdef IGNORE_UNKNOWN_KEYCODES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6223
	    if (arg == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6224
		/* happens sometimes (alt-graph on sun has no keysym) */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6225
		RETURN (false);
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
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6228
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6229
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6230
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6231
	    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
  6232
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6233
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6234
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6235
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6236
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6237
	    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
  6238
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6239
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6240
	case ButtonPress:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6241
	    sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6242
	    goto buttonPressAndRelease;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6243
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6244
	case ButtonRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6245
	    sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6246
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6247
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6248
	buttonPressAndRelease:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6249
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6250
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6251
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6252
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6253
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6254
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6255
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6256
	    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
  6257
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6258
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6259
	case MotionNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6260
	    __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
  6261
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6262
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6263
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6264
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6265
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6266
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6267
	    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
  6268
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6269
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6270
	case FocusIn:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6271
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6272
	    goto focusInOut;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6273
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6274
	case FocusOut:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6275
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6276
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6277
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6278
	focusInOut:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6279
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6280
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6281
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6282
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6283
	case EnterNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6284
	    __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
  6285
	    goto enterLeave;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6286
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6287
	case LeaveNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6288
	    __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
  6289
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6290
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6291
	enterLeave:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6292
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6293
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6294
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6295
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6296
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6297
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6298
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6299
	    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
  6300
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6301
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6302
	case Expose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6303
	    __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
  6304
	    goto expose;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6305
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6306
	case GraphicsExpose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6307
	    __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
  6308
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6309
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6310
	expose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6311
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6312
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6313
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6314
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6315
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6316
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6317
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6318
	case NoExpose:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6319
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6320
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6321
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6322
	case VisibilityNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6323
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6324
	    switch (ve->state) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6325
		case VisibilityUnobscured:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6326
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured);
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
		case VisibilityPartiallyObscured:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6329
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6330
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6331
		case VisibilityFullyObscured:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6332
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6333
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6334
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6335
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6336
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6337
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6338
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6339
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6340
	case CreateNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6341
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6342
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6343
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6344
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6345
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6346
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6347
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6348
	case DestroyNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6349
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6350
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6351
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6352
	case UnmapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6353
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6354
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6355
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6356
	case MapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6357
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6358
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6359
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6360
	case ConfigureNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6361
	    __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
  6362
	    __ArrayInstPtr(anEventArray)->a_element[3] = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6363
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6364
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6365
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6366
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ce->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6367
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ce->border_width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6368
	   __ArrayInstPtr(anEventArray)->a_element[9] = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6369
	    __ArrayInstPtr(anEventArray)->a_element[10] = ce->override_redirect ? true : false;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6370
	    if (ce->event != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6371
		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
  6372
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6373
	    if (ce->above != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6374
		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
  6375
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6376
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6377
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6378
	case GravityNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6379
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6380
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6381
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6382
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6383
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6384
	case ResizeRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6385
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6386
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6387
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6388
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6389
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6390
	case ConfigureRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6391
	    __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
  6392
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6393
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6394
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6395
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6396
	    __ArrayInstPtr(anEventArray)->a_element[7] = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6397
	    if (cr->above != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6398
		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
  6399
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6400
	    switch (cr->detail) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6401
		case Above:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6402
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6403
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6404
		case Below:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6405
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6406
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6407
		case TopIf:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6408
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6409
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6410
		case BottomIf:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6411
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6412
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6413
		case Opposite:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6414
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6415
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6416
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6417
		    __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6418
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6419
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6420
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6421
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6422
	case CirculateNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6423
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6424
	    goto circulate;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6425
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6426
	case CirculateRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6427
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6428
	    /* fall into */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6429
	circulate:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6430
	    switch (cie->place) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6431
		case PlaceOnTop:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6432
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6433
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6434
		case PlaceOnBottom:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6435
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6436
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6437
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6438
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6439
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6440
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6441
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6442
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6443
	case PropertyNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6444
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6445
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6446
	    switch (pe->state) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6447
		case PropertyNewValue:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6448
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6449
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6450
		case PropertyDelete:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6451
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6452
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6453
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6454
		    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6455
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6456
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6457
	    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
  6458
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6459
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6460
	case SelectionClear:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6461
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6462
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6463
	    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
  6464
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6465
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6466
	case SelectionRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6467
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6468
	     * someone wants the selection
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6469
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6470
	    __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
  6471
	    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
  6472
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6473
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6474
	    __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6475
	    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
  6476
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6477
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6478
	case SelectionNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6479
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6480
	     * returned selection value (answer from SelectionRequest)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6481
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6482
	    __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
  6483
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6484
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6485
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6486
	    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
  6487
	    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
  6488
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6489
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6490
	case ColormapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6491
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6492
	    __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6493
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6494
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6495
	case ClientMessage:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6496
	    if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6497
		if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6498
		 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6499
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:);
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
		if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6503
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6504
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6505
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6506
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6507
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6508
	     * any other client message
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6509
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6510
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6511
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6512
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6513
	    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
  6514
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6515
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6516
	case MappingNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6517
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6518
	    switch(mape->request) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6519
		case MappingModifier:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6520
		    arg = @symbol(mappingModifier);
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
		case MappingKeyboard:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6523
		    arg = @symbol(mappingKeyboard);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6524
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6525
		case MappingPointer:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6526
		    arg = @symbol(mappingPointer);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6527
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6528
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6529
		    arg = __MKSMALLINT(mape->request);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6530
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6531
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6532
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6533
	    t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6534
	    __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6535
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6536
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6537
	case KeymapNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6538
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6539
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6540
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6541
	case MapRequest:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6542
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6543
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6544
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6545
	case ReparentNotify:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6546
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6547
	    t = __MKEXTERNALADDRESS(rpe->parent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6548
	    __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6549
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6550
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6551
	    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6552
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6553
	default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6554
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6555
	    break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6556
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6557
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6558
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6559
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6560
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6561
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6562
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6563
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6564
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6565
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6566
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6567
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6568
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6569
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6570
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6571
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6572
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6573
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6574
#undef rr
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6575
#undef rpe
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6576
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  6577
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6578
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6579
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6580
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6581
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6582
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6583
    ^ true
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6584
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6585
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6586
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6587
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6588
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6589
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6590
!
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
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6593
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6594
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6595
    dispatchingExpose := aView id
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6596
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6597
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6598
registerHotKeyForWindow:aDrawableId withId:anId modifiers:aModifier virtualKeyCode:aVirtualKeyCode
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6599
    "Defines a system-wide hot key."
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6600
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6601
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6602
    "no-op until implemented"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6603
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6604
    ^ false.
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6605
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6606
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6607
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6608
    "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
  6609
     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
  6610
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6611
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6612
%{
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6613
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6614
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6615
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6616
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6617
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6618
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6619
	mask = __intVal(aMask);
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
#ifdef OLD
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6622
	/* these may not be disabled */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6623
	mask |= ExposureMask | StructureNotifyMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6624
		KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6625
		EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6626
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6627
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6628
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6629
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6630
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6631
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6632
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6633
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6634
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6635
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6636
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6637
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6638
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6639
    "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
  6640
6252
35df59ca8863 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  6641
    (dispatchProcess notNil and:[dispatchProcess isDead not]) ifTrue:[^ self].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6642
    dispatchingExpose := nil.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  6643
    super startDispatch.
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6644
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6645
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6646
unregisterHotKeyForWindow:aDrawableId withId:anId
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6647
    "Release a system-wide hot key."
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6648
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6649
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6650
    "no-op until implemented. Since we never registered anything, the unregister succeeds"
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
    ^ true.
6294
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6653
!
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6654
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6655
viewIsRelevantInCheckForEndOfDispatch:aView
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6656
    aView == windowGroupWindow ifTrue:[^ false].
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6657
    ^ super viewIsRelevantInCheckForEndOfDispatch:aView
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6658
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6659
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6660
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6661
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6662
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
  6663
    "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
  6664
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6665
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6666
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6667
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6668
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6669
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6670
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6671
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6672
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6673
    "/ Event.xclient.format            = msgFormat;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6674
    "/ Event.xclient.window            = windowID;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6675
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6676
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6677
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6678
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6679
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6680
    "/
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6681
    "/ XSendEvent(dpy, targetWindowID, propagate, eventMask, &Event);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6682
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6683
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6684
%{
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6685
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6686
    int state;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6687
    int __eventMask;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6688
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6689
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6690
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6691
     && __isInteger(msgFormat)
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6692
     && (eventMask == nil || __isInteger(eventMask))
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6693
     && (__isExternalAddress(windowID) || __isInteger(windowID))
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6694
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6695
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6696
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6697
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6698
	Window targetWindow;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6699
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6700
	if (__isInteger(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6701
	    ev.xclient.data.l[0] = __longIntVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6702
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6703
	    if (__isExternalAddress(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6704
		ev.xclient.data.l[0] = (INT)__externalAddressVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6705
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6706
		ev.xclient.data.l[0] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6707
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6708
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6709
	if (__isInteger(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6710
	    ev.xclient.data.l[1] = __longIntVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6711
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6712
	    if (__isExternalAddress(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6713
		ev.xclient.data.l[1] = (INT)__externalAddressVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6714
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6715
		ev.xclient.data.l[1] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6716
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6717
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6718
	if (__isInteger(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6719
	    ev.xclient.data.l[2] = __longIntVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6720
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6721
	    if (__isExternalAddress(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6722
		ev.xclient.data.l[2] = (INT)__externalAddressVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6723
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6724
		ev.xclient.data.l[2] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6725
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6726
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6727
	if (__isInteger(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6728
	    ev.xclient.data.l[3] = __longIntVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6729
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6730
	    if (__isExternalAddress(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6731
		ev.xclient.data.l[3] = (INT)__externalAddressVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6732
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6733
		ev.xclient.data.l[3] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6734
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6735
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6736
	if (__isInteger(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6737
	    ev.xclient.data.l[4] = __longIntVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6738
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6739
	    if (__isExternalAddress(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6740
		ev.xclient.data.l[4] = (INT)__externalAddressVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6741
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6742
		ev.xclient.data.l[4] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6743
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6744
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6745
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6746
	if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6747
	    ev.xclient.window = __WindowVal(windowID);
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.window = (Window)__longIntVal(windowID);
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
	if (__isExternalAddress(targetWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6753
	    targetWindow = __WindowVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6754
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6755
	    targetWindow = (Window)__longIntVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6756
	}
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
	ev.xclient.type              = ClientMessage;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6759
	ev.xclient.display           = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6760
	ev.xclient.message_type      = __longIntVal(msgType);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6761
	ev.xclient.format            = __longIntVal(msgFormat);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6762
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6763
	if (eventMask == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6764
	    __eventMask = NoEventMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6765
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6766
	    __eventMask = __longIntVal(eventMask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6767
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6768
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6769
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6770
	result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6771
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6772
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6773
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6774
	    DPRINTF(("bad status in sendClientEvent\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6775
	    RETURN ( false )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6776
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6777
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6778
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6779
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6780
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6781
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6782
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6783
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6784
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
  6785
    "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
  6786
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6787
     For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...);
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6788
     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
  6789
     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
  6790
     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
  6791
     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
  6792
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6793
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6794
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6795
%{
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6796
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6797
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6798
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6799
    if (__isSmallInteger(stateMask)) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6800
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6801
    } else {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6802
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6803
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6804
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6805
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6806
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  6807
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr))
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6808
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6809
	Display *dpy = myDpy;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6810
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6811
	XEvent ev;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6812
	Window target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6813
	Status result;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6814
	KeySym keySym, *syms;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6815
	int screen = __intVal(__INST(screen));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6816
	int nSyms;
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
	if ((typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6819
	 || (typeSymbol == @symbol(keyRelease))) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6820
	    if (__isStringLike(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6821
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6822
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6823
		if (__isCharacter(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6824
		    char s[2];
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6825
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6826
		    s[1] = '\0';
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6827
		    keySym = XStringToKeysym(s);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6828
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6829
		    if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6830
			keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6831
		    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6832
			goto notOk;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6833
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6834
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6835
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6836
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6837
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6838
	    if (stateMask == nil) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6839
		/*
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6840
		 * get the modifier from the keySym
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
		nSyms = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6843
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6844
		if (syms) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6845
		    int i;
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
		    for (i=0; i<nSyms; i++) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6848
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6849
#ifdef MODIFIERDEBUG
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6850
			    console_printf("modifier-index is %d\n", i);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6851
#endif
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6852
			    if (i) state = (1 << (i-1));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6853
			    break;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6854
			}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6855
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6856
		    XFree(syms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6857
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6858
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6859
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6860
	    if ((typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6861
	     || (typeSymbol == @symbol(buttonRelease))) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6862
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6863
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6864
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6865
		    ev.xbutton.button = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6866
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6867
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6868
		DPRINTF(("invalid sendEvent typeSymbol\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6869
		RETURN (false);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6870
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6871
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6872
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6873
	if (typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6874
	    ev.xany.type = KeyPress;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6875
	else if (typeSymbol == @symbol(keyRelease))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6876
	    ev.xany.type = KeyRelease;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6877
	else if (typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6878
	    ev.xany.type = ButtonPress;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6879
	else if (typeSymbol == @symbol(buttonRelease))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6880
	    ev.xany.type = ButtonRelease;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6881
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6882
	if (__isExternalAddress(targetId)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6883
	    target = __WindowVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6884
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6885
	    target = (Window) __longIntVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6886
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6887
	ev.xkey.window = target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6888
	ev.xkey.same_screen = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6889
	ev.xkey.subwindow = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6890
	ev.xkey.root = RootWindow(dpy, screen);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6891
	ev.xkey.x = __intVal(xPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6892
	ev.xkey.y = __intVal(yPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6893
	ev.xkey.state = state;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6894
	ev.xkey.time = CurrentTime;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6895
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6896
	ENTER_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6897
	result = XSendEvent(dpy, target, False, 0 , &ev);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6898
	LEAVE_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6899
	if ((result == BadValue) || (result == BadWindow)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6900
	    DPRINTF(("bad status\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6901
	    RETURN ( false )
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
	RETURN (true)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6904
    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6905
  notOk: ;
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6906
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6907
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6908
    ^ false
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6909
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6910
    "<<END
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6911
     |v|
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6912
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6913
     v := EditTextView extent:200@100.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6914
     v contents:'Hello world'.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6915
     v openAndWait.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6916
     v selectFromCharacterPosition:1 to:5.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6917
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6918
     "/ CTRL-c
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6919
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6920
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6921
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6922
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6923
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6924
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6925
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:'c'
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:#keyRelease
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:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6944
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6945
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6946
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6947
     "/ CTRL-v
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6948
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6949
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6950
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6951
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6952
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6953
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6954
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6955
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:'v'
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:#keyRelease
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:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6974
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6975
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6976
END"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6977
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6978
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6979
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6980
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6981
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6982
    "a basic method for X-font allocation; this method allows
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  6983
     any font to be acquired (even those not conforming to
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6984
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6985
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6986
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6987
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  6988
%{  /* STACK: 100000 */
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  6989
    /*** UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6990
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6991
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6992
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  6993
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  6994
     && __isStringLike(aFontName)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6995
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  6996
	ENTER_XLIB();
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  6997
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  6998
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6999
#ifdef COUNT_RESOURCES
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7000
	if (newFont)
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7001
	    __cnt_font++;
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7002
#endif
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7003
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7004
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7005
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7006
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  7007
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7008
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7009
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7010
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7011
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7012
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7013
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7014
     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
  7015
      -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
  7016
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7017
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7018
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7019
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7020
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7021
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7022
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7023
    fields size == 3 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7024
	"take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7025
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7026
	style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7027
	size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7028
    ] ifFalse:[fields size == 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7029
	"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7030
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7031
	size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7032
    ] ifFalse:[fields size >= 15 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7033
	family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7034
	face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7035
	style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7036
	style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7037
	    style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7038
	] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7039
	     style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7040
	] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7041
	     style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7042
	]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7043
	moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7044
	(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7045
	    style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7046
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7047
	fheight := fields at:8.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7048
	size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7049
	resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7050
	resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7051
	registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7052
	encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7053
	coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7054
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7055
	^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7056
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7057
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7058
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7059
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7060
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7061
encodingOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7062
    "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
  7063
     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
  7064
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7065
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7066
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7067
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7068
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7069
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7070
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7071
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7072
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7073
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7074
    coll notNil ifTrue:[ coll := self atomName:coll].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7075
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7076
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7077
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7078
     "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7079
       Screen current encodingOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7080
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7081
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7082
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7083
extentsOf:aString from:index1 to:index2 inFont:aFontId into:anArray
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7084
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7085
    <context: #return>
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7086
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7087
%{  /* UNLIMITEDSTACK */
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7088
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7089
    XFontStruct *f;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7090
    char *cp;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7091
    int len, n, i1, i2, l;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7092
#   define NLOCALBUFFER 200
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7093
    XChar2b xlatebuffer[NLOCALBUFFER];
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7094
    int nInstBytes;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7095
    int directionReturn, fontAscentReturn, fontDescentReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7096
    XCharStruct overAllReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7097
    OBJ *resultArray;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7098
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7099
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7100
	 && __bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7101
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7102
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7103
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7104
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7105
	if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7106
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7107
	if (__isArray(anArray) && __arraySize(anArray) > 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7108
	    resultArray = __arrayVal(anArray);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7109
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7110
	    resultArray = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7111
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7112
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7113
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7114
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7115
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7116
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7117
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7118
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7119
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7120
		RETURN ( __MKSMALLINT(0) );
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7123
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7124
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7125
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7126
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7127
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7128
		if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7129
		cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7130
		len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7131
					&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7132
					&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7133
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7134
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7135
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7136
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7137
		n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7138
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7139
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7140
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7141
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7142
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7143
		    len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7144
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7145
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7146
		} else  if (__isWords(aString)) { /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7147
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7148
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7149
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7150
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7151
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7152
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7153
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7154
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7155
		    n = n / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7156
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7157
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7158
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7159
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7160
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
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7163
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7164
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7165
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7166
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7167
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7168
		    if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7169
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7170
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7171
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7172
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7173
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7174
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7175
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7176
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7177
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7178
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7179
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7180
		    }
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
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7183
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7184
					    &overAllReturn);
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
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7187
			free(cp2);
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
		} else if (__isLongs(aString)) { /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7190
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7191
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7192
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7193
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7194
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7195
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7196
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7197
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7198
		    n = n / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7199
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7200
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7201
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7202
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7203
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
		     * 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
  7206
		     * 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
  7207
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7208
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7209
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7210
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7211
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7212
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7213
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7214
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7215
			int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7216
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7217
			codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7218
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7219
			    codePoint = 0xFFFF;
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
			cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7222
			cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
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
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7225
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7226
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7227
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7228
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7229
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7230
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7231
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7232
		} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7233
		    goto fail;      /*unknown string class */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7234
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7235
	    if (resultArray) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7236
		switch (__arraySize(anArray)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7237
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7238
		case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7239
		    resultArray[7] = __MKSMALLINT(directionReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7240
		case 7:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7241
		    resultArray[6] = __MKSMALLINT(fontDescentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7242
		case 6:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7243
		    resultArray[5] = __MKSMALLINT(fontAscentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7244
		case 5:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7245
		    resultArray[4] = __MKSMALLINT(overAllReturn.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7246
		case 4:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7247
		    resultArray[3] = __MKSMALLINT(overAllReturn.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7248
		case 3:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7249
		    resultArray[2] = __MKSMALLINT(overAllReturn.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7250
		case 2:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7251
		    resultArray[1] = __MKSMALLINT(overAllReturn.rbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7252
		case 1:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7253
		    resultArray[0] = __MKSMALLINT(overAllReturn.lbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7254
		case 0:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7255
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7256
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7257
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7258
	    RETURN ( __MKSMALLINT(overAllReturn.width) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7259
	}
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7260
    }
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7261
#undef NLOCALBUFFER
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7262
fail: ;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7263
%}.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7264
    self primitiveFailedOrClosedConnection.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7265
    ^ 0
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7266
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
      |result|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7269
      result := Array new:8.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7270
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7271
	extentsOf:'hello World' from:1 to:11
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7272
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7273
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7274
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7275
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7276
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7277
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7278
		    size:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7279
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7280
	    )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7281
	into:result.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7282
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7283
      result
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7284
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7285
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7286
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7287
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
  7288
    "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
  7289
     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
  7290
     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
  7291
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7292
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7293
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7294
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7295
    (registry size ~~ 0) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7296
	enc := registry asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7297
	encoding size ~~ 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7298
	   enc := enc, '-', encoding asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7299
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7300
	enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7301
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7302
	(encoding size ~~ 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7303
	    enc := encoding asLowercase asSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7304
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7305
	    charSets := charSetCollections.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7306
	    (charSets notEmptyOrNil) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7307
		charSets := charSets asUppercase asCollectionOfWords.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7308
		(charSets includes:'ISO8859-1') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7309
		    enc := #'iso8859-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7310
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7311
		    (charSets includes:'ISO8859') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7312
			enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7313
		    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7314
			(charSets includes:'ASCII') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7315
			    enc := #ascii
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7316
			] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7317
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7318
				enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7319
			    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7320
			]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7321
		    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7322
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7323
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7324
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7325
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7326
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7327
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7328
    "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
  7329
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7330
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7331
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7332
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7333
    "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
  7334
     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
  7335
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7336
    listOfXFonts := nil.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7337
    XftFontDescription notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7338
	XftFontDescription flushListOfAvailableFonts.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7339
    ].
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7340
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7341
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7342
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7343
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7344
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7345
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7346
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7347
    "Created: 20.2.1996 / 22:55:52 / cg"
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
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7350
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7351
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7352
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7353
     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
  7354
      -brand-family-face-style-moreStyle- -pxlSize-size-resX-resY-??-??-registry-encoding;
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7355
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7356
6010
6d7184a6456b cast to correct types
Stefan Vogel <sv@exept.de>
parents: 6009
diff changeset
  7357
    |family face style moreStyle size
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7358
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7359
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7360
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7361
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7362
    Error handle:[:ex |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7363
	family := nil.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7364
    ] do:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7365
	fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7366
	fields size == 3 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7367
	    "take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7368
	    family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7369
	    style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7370
	    size := Number readFromString:(fields at:3).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7371
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7372
	    fields size == 2 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7373
		"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7374
		family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7375
		size := Number readFromString:(fields at:2).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7376
	    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7377
		fields size >= 15 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7378
		    family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7379
		    face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7380
		    style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7381
		    style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7382
			style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7383
		    ] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7384
			 style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7385
		    ] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7386
			 style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7387
		    ]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7388
		    moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7389
		    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7390
			style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7391
		    ].
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7392
"/                    pxlSize := (Integer readFromString:(fields at:8)).
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7393
		    size := (Number readFromString:(fields at:9)) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7394
		    resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7395
		    resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7396
		    registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7397
		    encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7398
		    coding := registry , '-' , encoding.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7399
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7400
		    "/ very old name (such as cursor, 5x7 etc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7401
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7402
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7403
	].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7404
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7405
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7406
    family notNil ifTrue:[
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7407
       ^ 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
  7408
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7409
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7410
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
     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
  7413
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7414
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7415
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7416
fontMetricsOf:fontId
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7417
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7418
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7419
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7420
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7421
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7422
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7423
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7424
%{  /* UNLIMITEDSTACK */
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7425
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7426
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7427
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7428
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7429
	if (__isExternalAddress(fontId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7430
	    f = __FontVal(fontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7431
	    if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7432
		minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7433
		maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7434
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7435
		if (f->direction == FontLeftToRight) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7436
		    dir = @symbol(LeftToRight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7437
		} else if (f->direction == FontRightToLeft) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7438
		    dir = @symbol(RightToLeft);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7439
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7440
		avgAscent = __MKSMALLINT(f->ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7441
		avgDescent = __MKSMALLINT(f->descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7442
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7443
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7444
		minWidth = __MKSMALLINT(f->min_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7445
		maxWidth = __MKSMALLINT(f->max_bounds.width);
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
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7448
		len = XTextWidth(f, "n", 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7449
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7450
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7451
		avgWidth = __MKSMALLINT( len );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7452
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7453
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7454
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7455
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7456
    avgAscent == nil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7457
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7458
	^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7459
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7460
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7461
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7462
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7463
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7464
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7465
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7466
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7467
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7468
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7469
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7470
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7471
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7472
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7473
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7474
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7475
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7476
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7477
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7478
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7479
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7480
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7481
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7482
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7483
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7484
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7485
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7486
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7487
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7488
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7489
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7490
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7491
     PropertyNames is an array with property names (symbols or strings).
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  7492
     Nonexistent properties are returned as nil"
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7493
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7494
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7495
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7496
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7497
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7498
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7499
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7500
     Screen current
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7501
	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistent)
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7502
	of:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7503
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7504
!
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
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7507
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7508
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7509
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7510
     Even indices contain the property value (atom)
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
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7513
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7514
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7515
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7516
%{
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7517
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7518
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7519
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7520
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7521
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7522
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7523
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7524
	if (f && (prop = f->properties) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7525
	    n = f->n_properties;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7526
	    propsArray = __ARRAY_NEW_INT(n*2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7527
	    for (i = 0; n; n--, prop++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7528
		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
  7529
		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
  7530
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7531
	}
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7532
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7533
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7534
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7535
    propsArray notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7536
	propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7537
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7538
    ^ result
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
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7541
     Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7542
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1'))
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7543
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7544
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7545
     d := Dictionary new.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7546
     (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
  7547
	  d at:name put:((Screen current atomName:value) ? value)
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7548
     ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7549
     d
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7550
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7551
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7552
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7553
fontResolutionOf:fontId
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7554
    "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution,
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7555
     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
  7556
     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
  7557
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7558
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7559
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7560
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7561
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7562
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  7563
    (resX notNil and:[resY notNil]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7564
	^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7565
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7566
    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
  7567
    res notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7568
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7569
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7570
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7571
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7572
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7573
      Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7574
    "
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7575
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7576
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  7577
fullFontNameOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7578
    "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
  7579
     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
  7580
     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
  7581
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7582
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  7583
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7584
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7585
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7586
	|fullNameID|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7587
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7588
	fullNameID := props at:try ifAbsent:nil.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7589
	fullNameID notNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7590
	    fullName := self atomName:fullNameID.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7591
	    fullName notEmptyOrNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7592
		^ fullName
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7593
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7594
	]
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7595
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7596
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7597
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7598
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7599
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7600
     Screen current fullFontNameOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7601
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7602
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7603
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7604
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7605
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7606
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7607
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7608
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7609
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7610
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7611
    int nnames = 30000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7612
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7613
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7614
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7615
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7616
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7617
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7618
	if (__isStringLike(pattern)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7619
	    for (;;) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7620
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7621
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7622
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7623
		if (fonts == 0) RETURN(nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7624
		if (available < nnames) break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7625
		XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7626
		nnames = available * 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7627
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7628
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7629
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7630
	     * now, that we know the number of font names,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7631
	     * create the array ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7632
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7633
	    arr = __ARRAY_NEW_INT(available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7634
	    if (arr != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7635
		/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7636
		 * ... and fill it
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
		for (i=0; i<available; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7639
		    __PROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7640
		    str = __MKSTRING(fonts[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7641
		    __UNPROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7642
		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7643
		}
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
	    XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7646
	    RETURN (arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7647
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7648
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7649
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7650
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7651
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7652
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7653
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7654
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7655
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7656
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7657
getDefaultFontWithEncoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7658
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7659
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7660
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7661
    |id|
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7662
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7663
    id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding.
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7664
    id isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7665
	id := self createFontFor:'fixed'
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7666
    ].
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7667
    ^ id.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7668
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7669
     "
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7670
       Screen current getDefaultFontWithEncoding:#'iso10646-1'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7671
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7672
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7673
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7674
getFontWithFamily:familyString face:faceString
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7675
	    style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7676
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7677
    "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
  7678
     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
  7679
     as family and the other parameters as nil. For example, the cursor font
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  7680
     can be acquired that way."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7681
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7682
    |styleString theName theId xlatedStyle
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7683
     id spacing encodingMatch idx roundedSize pixelSize pointSize|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7684
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7685
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7686
5176
0c9f21d81a71 preps for pixel-sized fonts
Claus Gittinger <cg@exept.de>
parents: 5071
diff changeset
  7687
    sizeArgOrNil notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7688
	roundedSize := sizeArgOrNil rounded asInteger.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7689
	sizeUnit == #px ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7690
	    pixelSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7691
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7692
	    pointSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7693
	].
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  7694
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  7695
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7696
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7697
    faceString isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7698
	roundedSize notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7699
	    theName := familyString , '-' , roundedSize printString
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
	    theName := familyString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7702
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7703
	theName notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7704
	    theId := self createFontFor:theName.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7705
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7706
	theId isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7707
	    theId := self getDefaultFontWithEncoding:encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7708
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7709
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7710
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7711
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7712
    "/ 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
  7713
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7714
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  7715
    (styleString notNil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7716
     and:[(styleString endsWith:'-narrow')
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7717
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7718
	|i|
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7719
	i := styleString lastIndexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7720
	spacing := styleString copyFrom:(i+1).
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7721
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7722
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7723
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7724
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7725
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7726
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7727
    xlatedStyle notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7728
	xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  7729
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  7730
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7731
    encoding isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7732
	encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7733
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7734
	idx := encoding indexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7735
	idx ~~ 0 ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7736
	    encodingMatch := encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7737
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7738
	    encodingMatch := encoding , '-*'.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7739
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7740
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7741
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7742
    id := self
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7743
	    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7744
	    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7745
	    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7746
	    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7747
	    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7748
	    pixelSize:pixelSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7749
	    size:pointSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7750
	    encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7751
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7752
    id isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7753
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7754
	    "/ too stupid: registries come in both cases
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7755
	    "/ and X does not ignore case
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7756
	    "/
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7757
	    id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7758
		    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7759
		    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7760
		    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7761
		    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7762
		    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7763
		    pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7764
		    size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7765
		    encoding:encodingMatch asUppercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7766
	    id isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7767
		id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7768
			getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7769
			family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7770
			weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7771
			slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7772
			spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7773
			pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7774
			size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7775
			encoding:encodingMatch asLowercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7776
	    ]
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7777
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7778
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7779
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7780
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7781
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7782
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7783
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7784
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7785
getFontWithFoundry:foundry family:family weight:weight
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7786
	      slant:slant spacing:spc pixelSize:pSize size:size
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7787
	      encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7788
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7789
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7790
     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
  7791
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7792
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7793
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7794
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7795
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7796
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7797
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7798
     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
  7799
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
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
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7802
    |theName sizeMatch
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7803
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  7804
     pSizeMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7805
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7806
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7807
    "name is:
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7808
	-foundry-family    -weight -slant-
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7809
	 sony    helvetica bold     r
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7810
	 adobe   courier   medium   i
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7811
	 msic    fixed              o
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7812
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7813
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7814
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7815
    size isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7816
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7817
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7818
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7819
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7820
    foundry isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7821
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7822
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7823
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7824
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7825
    family isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7826
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7827
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7828
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7829
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7830
    weight isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7831
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7832
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7833
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7834
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7835
    slant isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7836
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7837
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7838
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7839
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7840
    spc isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7841
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7842
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7843
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7844
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7845
    pSize isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7846
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7847
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7848
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7849
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7850
    encoding isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7851
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7852
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7853
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7854
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7855
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7856
    theName := ('-' , foundryMatch,
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7857
		'-' , familyMatch,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7858
		'-' , weightMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7859
		'-' , slantMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7860
		'-' , spcMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7861
		'-*' ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7862
		'-' , pSizeMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7863
		'-' , sizeMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7864
		'-*-*-*-*' ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7865
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7866
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  7867
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7868
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7869
    ^ self createFontFor:theName.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7870
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7871
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7872
    "
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7873
     Display
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7874
	getFontWithFoundry:'*'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7875
	family:'courier'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7876
	weight:'medium'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7877
	slant:'r'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7878
	spacing:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7879
	pixelSize:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7880
	size:13
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7881
	encoding:#'iso8859-1'.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7882
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7883
     Display
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7884
	getFontWithFoundry:'*'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7885
	family:'courier'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7886
	weight:'medium'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7887
	slant:'r'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7888
	spacing:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7889
	pixelSize:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7890
	size:13
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7891
	encoding:#'iso10646-1'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7892
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7893
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7894
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7895
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7896
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7897
heightOf:aString from:index1 to:index2 inFont:aFontId
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7898
    |resultArray|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7899
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7900
    resultArray := Array new:5.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7901
    self extentsOf:aString from:index1 to:index2 inFont:aFontId into:resultArray.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7902
    ^ (resultArray at:4) + (resultArray at:5).
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7903
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7904
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7905
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7906
	heightOf:'hello world' from:1 to:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7907
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7908
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7909
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7910
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7911
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7912
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7913
		    size:13
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7914
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7915
	    ).
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7916
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7917
      Screen current
8053
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
  7918
	heightOf:'hello World gggÖÜ' from:1 to:15
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7919
	inFont:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7920
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7921
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7922
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7923
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7924
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7925
     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
  7926
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7927
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7928
6630
81c3e5842617 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6571
diff changeset
  7929
    |names listOfXftFonts|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7930
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7931
    listOfXFonts isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7932
	names := self getAvailableFontsMatching:'*'.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7933
	names isNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7934
	    "no names returned ..."
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7935
	    ^ nil
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7936
	].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7937
	listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7938
	listOfXFonts := FontDescription genericFonts, listOfXFonts.
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7939
    ].
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7940
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7941
    self supportsXftFonts ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7942
	UserPreferences current useXFontsOnly ifFalse:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7943
	    listOfXftFonts := XftFontDescription listOfAvailableFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7944
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7945
	    UserPreferences current useXftFontsOnly ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7946
		^ listOfXftFonts
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7947
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7948
	    ^ listOfXftFonts , listOfXFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7949
	].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7950
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7951
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7952
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7953
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7954
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7955
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7956
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7957
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7958
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7959
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7960
    "
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
    "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
  7963
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7964
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7965
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7966
pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7967
    "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
  7968
     on this display.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7969
     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
  7970
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7971
    |sizes|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7972
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7973
    sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7974
    (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7975
	"special: in X11R5 and above, size 0 means:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7976
	 there are scaled versions in all sizes available"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7977
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7978
	^ #(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
  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
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  7983
     Display pixelSizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7984
    "
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7985
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7986
    "Created: 27.2.1996 / 01:38:15 / cg"
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7987
!
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7988
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7989
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7990
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7991
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7992
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7993
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7994
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  7995
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  7996
     * 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
  7997
     */
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  7998
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7999
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8000
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8001
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8002
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8003
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8004
	if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8005
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8006
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8007
	    XFreeFont(myDpy, f);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8008
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  8009
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8010
	    __cnt_font--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8011
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8012
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8013
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8014
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8015
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8016
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8017
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8018
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8019
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8020
    "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
  8021
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8022
     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
  8023
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8024
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8025
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8026
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8027
    (sizes notNil and:[sizes includes:0]) ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8028
	"special: in X11R5 and above, size 0 means:
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8029
	 there are scaled versions in all sizes available"
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8030
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8031
	^ #(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
  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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8035
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  8036
     Display sizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8037
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8038
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8039
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8040
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8041
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8042
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8043
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8044
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8045
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8046
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8047
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8048
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8049
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8050
    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
  8051
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8052
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  8053
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8054
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8055
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8056
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8057
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8058
	if (__bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8059
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8060
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8061
	    int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8062
	    f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8063
	    if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8064
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8065
	    i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8066
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8067
	    if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8068
		OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8069
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8070
		i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8071
		if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8072
		    RETURN ( __MKSMALLINT(0) );
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8075
		cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8076
		l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8077
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8078
		if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8079
		    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8080
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8081
			cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8082
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8083
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8084
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8085
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8086
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8087
			//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
  8088
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8089
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8090
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8091
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8092
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8093
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8094
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8095
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8096
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8097
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8098
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8099
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8100
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8101
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8102
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8103
		    n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8104
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8105
			cp += i1;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8106
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8107
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8108
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8109
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8110
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8111
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8112
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8113
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8114
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8115
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8116
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8117
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8118
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8119
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8120
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8121
		/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8122
		if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8123
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8124
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8125
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8126
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8127
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8128
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8129
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8130
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8131
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8132
			int mustFree = 0;
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
			cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8135
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8136
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8137
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8138
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8139
			 * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8140
			 * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8141
			 */
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
			u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8144
			if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8145
			    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8146
				cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8147
			    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8148
				cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8149
				mustFree = 1;
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
			    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8152
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8153
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8154
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8155
			    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8156
			}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8157
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8158
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8159
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8160
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8161
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8162
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8163
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8164
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8165
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8166
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8167
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8168
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8169
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8170
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8171
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8172
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8173
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8174
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8175
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8176
		/* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8177
		if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8178
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8179
		    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8180
		    int mustFree = 0;
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
		    n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8183
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8184
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8185
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8186
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8187
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8188
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8189
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8190
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8191
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8192
			cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8193
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8194
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8195
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8196
			 * 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
  8197
			 * 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
  8198
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8199
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8200
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8201
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8202
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8203
			    mustFree = 1;
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 (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8206
			    int codePoint;
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
			    codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8209
			    if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8210
				codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8211
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8212
			    cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8213
			    cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8214
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8215
			cp = (char *) cp2;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8216
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8217
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8218
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8219
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8220
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8221
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8222
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8223
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8224
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8225
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8226
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8227
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8228
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8229
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8230
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8231
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8232
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8233
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8234
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8235
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8236
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8237
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8238
#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
  8239
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8240
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8241
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  8242
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8243
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8244
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  8245
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8246
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8247
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8248
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8249
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8250
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8251
    int _mode, ok = 1;
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
    if (mode == @symbol(asyncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8254
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8255
    else if (mode == @symbol(syncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8256
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8257
    else if (mode == @symbol(asyncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8258
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8259
    else if (mode == @symbol(syncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8260
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8261
    else if (mode == @symbol(syncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8262
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8263
    else if (mode == @symbol(asyncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8264
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8265
    else if (mode == @symbol(replayPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8266
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8267
    else if (mode == @symbol(replayKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8268
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8269
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8270
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8271
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8272
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8273
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8274
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8275
	XAllowEvents(myDpy, _mode, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8276
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8277
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8278
	RETURN (self);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8279
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8280
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8281
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8282
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8283
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8284
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8285
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8286
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8287
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8288
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8289
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8290
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8291
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8292
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8293
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8294
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8295
	    result = XGrabKeyboard(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8296
				   __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8297
				   True /* False */,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8298
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8299
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8300
				   CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8301
	    LEAVE_XLIB();
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
	    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8304
	    switch(result) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8305
		case AlreadyGrabbed:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8306
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8307
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8308
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8309
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8310
		case GrabNotViewable:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8311
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8312
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8313
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8314
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8315
		case GrabInvalidTime:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8316
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8317
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8318
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8319
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8320
		case GrabFrozen:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8321
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8322
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8323
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8324
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8325
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8326
		    ok = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8327
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8328
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8329
	    if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8330
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8331
		XUngrabKeyboard(myDpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8332
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8333
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8334
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8335
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8336
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8337
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8338
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8339
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8340
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8341
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8342
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8343
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8344
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
  8345
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8346
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8347
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8348
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8349
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8350
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8351
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8352
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8353
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8354
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8355
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8356
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8357
	    if (__isExternalAddress(confineId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8358
		confineWin = __WindowVal(confineId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8359
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8360
		confineWin = (Window) None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8361
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8362
	    if (__isExternalAddress(aCursorId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8363
		curs = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8364
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8365
		curs = (Cursor) None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8366
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8367
	    if (pMode == @symbol(sync))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8368
		pointer_mode = GrabModeSync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8369
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8370
		pointer_mode = GrabModeAsync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8371
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8372
	    if (kMode == @symbol(sync))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8373
		keyboard_mode = GrabModeSync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8374
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8375
		keyboard_mode = GrabModeAsync;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8376
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8377
	    if (__isSmallInteger(eventMask))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8378
		evMask = __intVal(eventMask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8379
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8380
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8381
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8382
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8383
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8384
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8385
*/
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8386
	    result = XGrabPointer(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8387
				  __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8388
				  False,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8389
				  evMask,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8390
				  pointer_mode, keyboard_mode,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8391
				  confineWin,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8392
				  curs,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8393
				  CurrentTime);
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
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8396
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8397
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8398
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8399
	    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8400
	    switch (result) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8401
		case AlreadyGrabbed:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8402
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8403
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8404
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8405
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8406
		case GrabNotViewable:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8407
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8408
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8409
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8410
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8411
		case GrabInvalidTime:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8412
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8413
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8414
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8415
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8416
		case GrabFrozen:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8417
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8418
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8419
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8420
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8421
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8422
		    ok = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8423
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8424
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8425
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8426
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8427
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8428
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8429
*/
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8430
		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
  8431
/*
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8432
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8433
*/
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8434
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8435
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8436
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8437
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8438
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8439
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8440
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8441
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8442
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8443
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8444
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
  8445
    "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
  8446
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8447
    ^ self
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8448
	grabPointerIn:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8449
	withCursor:aCursorId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8450
	eventMask:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8451
	pointerMode:pMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8452
	keyboardMode:kMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8453
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8454
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8455
    "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
  8456
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8457
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8458
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8459
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8460
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8461
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8462
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8463
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8464
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8465
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8466
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8467
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8468
	XUngrabKeyboard(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8469
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8470
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8471
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8472
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8473
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8474
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8475
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8476
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8477
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8478
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8479
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8480
%{
3225
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
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8483
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8484
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8485
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8486
	XUngrabPointer(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8487
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8488
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8489
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
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8492
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8493
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8494
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8495
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8496
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8497
    activeKeyboardGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8498
	activeKeyboardGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8499
	self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  8500
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8501
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8502
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8503
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8504
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8505
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8506
    activePointerGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8507
	activePointerGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8508
	self primUngrabPointer.
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
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8512
!XWorkstation methodsFor:'grabbing-keys'!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8513
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8514
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
  8515
    "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
  8516
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8517
     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
  8518
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8519
     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
  8520
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8521
     ModeKbd and modePtr are symbols GrabModeAsync or GrabModeSync.
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
     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
  8524
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8525
     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
  8526
     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
  8527
     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
  8528
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8529
     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
  8530
     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
  8531
    "
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8532
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
    int modifierMask = AnyModifier;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8535
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8536
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8537
    if (__isStringLike(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8538
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8539
    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8540
	if (__isCharacter(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8541
	    char s[2];
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
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8544
	    s[1] = '\0';
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8545
	    keySym = XStringToKeysym(s);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8546
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8547
	    if (__isSmallInteger(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8548
		keySym = (KeySym) __intVal(keySymCodeOrChar);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8549
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8550
		goto notOK;
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
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8553
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8554
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8555
    if (modifierMaskOrNil != nil) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8556
	if (__isSmallInteger(modifierMaskOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8557
	    modifierMask = __intVal(modifierMaskOrNil);
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
    if (ISCONNECTED) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8564
	Display *dpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8565
	Window window;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8566
	int keyCode;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8567
	int result;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8568
	int mKbd, mPtr;
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
	mKbd = modeKbd == @symbol(GrabModeAsync) ? GrabModeAsync :GrabModeSync;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8571
	mPtr = modePtr == @symbol(GrabModeAsync) ? GrabModeAsync :GrabModeSync;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8572
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8573
	dpy = myDpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8574
	keyCode = XKeysymToKeycode(dpy, keySym);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8575
	if (__isExternalAddress(aWindowIdOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8576
	    window = __WindowVal(aWindowIdOrNil);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8577
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8578
	    int screen;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8579
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8580
	    screen = DefaultScreen(dpy);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8581
	    window = RootWindow(dpy, screen);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8582
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8583
	ENTER_XLIB();
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8584
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8585
	result = XGrabKey (dpy,
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8586
	    keyCode, modifierMask, window,
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8587
	    False, mKbd, mPtr );
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
	XSync(dpy, True);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8590
	XFlush(dpy);
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
	LEAVE_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
	if (result != Success) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8595
	    if (result == BadAccess) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8596
		__INST(lastError) = @symbol(badAccess);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8597
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8598
		__INST(lastError) = @symbol(other);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8599
	    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8600
	    RETURN (false);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8601
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8602
	RETURN (true);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8603
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8604
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8605
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8606
    self primitiveFailedOrClosedConnection
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8607
!
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
grabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8610
    "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
  8611
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8612
     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
  8613
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8614
     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
  8615
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8616
     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
  8617
     (GrabModeAsync)"
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8618
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8619
    ^ self
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8620
	grabKey:keySymCodeOrChar
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8621
	modifier:modifierMaskOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8622
	grabModeKeyboard:#GrabModeAsync
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8623
	grabModePointer:#GrabModeAsync
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8624
	window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8625
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8626
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8627
ungrabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8628
    "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
  8629
     Read the comment there."
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8630
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8631
%{
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8632
    int modifierMask = AnyModifier;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8633
    KeySym keySym, *syms;
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
    if (__isStringLike(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8636
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8637
    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8638
	if (__isCharacter(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8639
	    char s[2];
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
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8642
	    s[1] = '\0';
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8643
	    keySym = XStringToKeysym(s);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8644
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8645
	    if (__isSmallInteger(keySymCodeOrChar)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8646
		keySym = (KeySym) __intVal(keySymCodeOrChar);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8647
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8648
		goto notOK;
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
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8651
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8652
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8653
    if (modifierMaskOrNil != nil) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8654
	if (__isSmallInteger(modifierMaskOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8655
	    modifierMask = __intVal(modifierMaskOrNil);
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
    if (ISCONNECTED) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8662
	Display *dpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8663
	Window window;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8664
	int keyCode;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8665
	int result;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8666
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8667
	dpy = myDpy;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8668
	if (__isExternalAddress(aWindowIdOrNil)) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8669
	    window = __WindowVal(aWindowIdOrNil);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8670
	} else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8671
	    int screen;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8672
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8673
	    screen = DefaultScreen(dpy);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8674
	    window = RootWindow(dpy, screen);
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
	keyCode = XKeysymToKeycode(dpy, keySym);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8677
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8678
	ENTER_XLIB();
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8679
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8680
	result = XUngrabKey (dpy, keyCode, modifierMask, window);
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
	XSync(dpy, True);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8683
	XFlush(dpy);
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
	LEAVE_XLIB();
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
	if (result != Success) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8688
	    if (result == BadAccess) {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8689
		__INST(lastError) = @symbol(badAccess);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8690
	    } else {
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8691
		__INST(lastError) = @symbol(other);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8692
	    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8693
	    RETURN (false);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8694
	}
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8695
	RETURN (true);
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8696
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8697
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8698
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8699
    self primitiveFailedOrClosedConnection
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8700
! !
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8701
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8702
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8703
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8704
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8705
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8706
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8707
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8708
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8709
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8710
    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
  8711
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8712
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8713
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8714
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8715
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8716
	    gcv.clip_mask = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8717
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8718
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8719
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8720
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8721
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8722
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8723
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8724
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8725
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8726
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8727
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8728
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8729
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8730
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8731
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8732
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8733
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8734
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8735
	 && __isSmallInteger(bgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8736
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8737
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8738
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8739
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8740
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8741
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8742
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8743
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8744
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8745
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8746
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8747
    "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
  8748
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8749
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8750
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8751
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8752
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8753
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8754
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8755
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8756
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8757
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8758
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8759
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8760
	    if (__isExternalAddress(aBitmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8761
		bitmap = __PixmapVal(aBitmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8762
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8763
		XSetStipple(dpy, gc, bitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8764
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8765
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8766
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8767
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8768
	    if (aBitmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8769
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8770
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8771
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8772
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8773
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8774
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8775
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8776
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8777
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8778
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8779
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  8780
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8781
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8782
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8783
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8784
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8785
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8786
    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
  8787
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8788
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8789
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8790
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8791
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8792
	    if (aBool == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8793
		gcv.subwindow_mode = ClipByChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8794
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8795
		gcv.subwindow_mode = IncludeInferiors;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8796
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8797
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8798
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8799
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8800
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8801
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8802
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8803
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8804
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8805
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8806
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8807
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
  8808
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8809
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8810
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8811
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8812
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8813
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8814
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8815
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8816
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8817
	 && __bothSmallInteger(clipX, clipY)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8818
	 && __bothSmallInteger(clipWidth, clipHeight)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8819
	    r.x = __intVal(clipX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8820
	    r.y = __intVal(clipY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8821
	    r.width = __intVal(clipWidth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8822
	    r.height = __intVal(clipHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8823
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8824
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8825
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8826
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8827
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8828
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8829
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8830
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8831
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8832
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8833
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8834
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8835
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8836
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8837
%{
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8838
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8839
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8840
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8841
	 && __isSmallInteger(offset)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8842
	 && __isByteArrayLike(dashList)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8843
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8844
	    XSetDashes(myDpy, __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8845
		       __intVal(offset),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8846
		       __ByteArrayInstPtr(dashList)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8847
		       __byteArraySize(dashList));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8848
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8849
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8850
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8851
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8852
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8853
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8854
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8855
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8856
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8857
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8858
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8859
    self primitiveFailedOrClosedConnection
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8862
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8863
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8864
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8865
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8866
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8867
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8868
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8869
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8870
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8871
	if (__isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8872
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8873
	    f = (XFontStruct *) __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8874
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8875
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8876
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8877
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8878
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8879
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8880
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8881
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8882
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8883
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8884
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8885
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8886
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8887
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8888
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8889
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8890
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8891
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8892
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8893
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8894
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8895
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8896
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8897
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8898
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8899
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8900
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8901
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8902
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8903
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8904
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8905
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8906
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8907
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8908
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8909
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8910
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8911
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8912
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8913
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8914
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8915
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8916
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8917
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8918
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8919
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8920
	 && __isSmallInteger(fgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8921
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8922
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8923
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8924
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8925
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8926
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8927
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8928
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8929
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8930
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8931
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8932
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8933
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8934
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8935
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8936
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8937
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8938
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8939
	if (__isExternalAddress(aGCId)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8940
	    GC gc = __GCVal(aGCId);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8941
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8942
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8943
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8944
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8945
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8946
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8947
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8948
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8949
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8950
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8951
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8952
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8953
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8954
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8955
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8956
	    if (fun != -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8957
		ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8958
		XSetFunction(myDpy, gc, fun);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8959
		LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8960
		RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8961
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8962
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8963
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8964
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8965
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8966
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8967
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8968
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8969
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8970
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8971
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8972
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8973
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8974
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8975
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8976
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8977
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8978
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8979
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8980
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8981
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8982
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8983
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8984
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8985
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8986
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  8987
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8988
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8989
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8990
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8991
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8992
    "set line attributes;
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8993
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8994
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  8995
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8996
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8997
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8998
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8999
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9000
    int x_style, x_cap, x_join;
6768
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9001
    static char dotList[2] = { 1,1 };
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9002
    static char dashList[2]  = { 4,4 };
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9003
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9004
    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
  9005
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9006
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9007
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9008
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9009
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9010
	 && __isSmallInteger(aNumber)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9011
	    Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9012
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9013
	    if (lineStyle == @symbol(solid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9014
		x_dashes = (char *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9015
		x_style = LineSolid;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9016
	    } else if (lineStyle == @symbol(dashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9017
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9018
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9019
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9020
	    } else if (lineStyle == @symbol(doubleDashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9021
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9022
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9023
		x_style = LineDoubleDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9024
	    } else if (lineStyle == @symbol(dotted)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9025
		x_dashes = dotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9026
		x_nDash = sizeof(dotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9027
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9028
	    } else if (lineStyle == @symbol(dashDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9029
		x_dashes = dashDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9030
		x_nDash = sizeof(dashDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9031
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9032
	    } else if (lineStyle == @symbol(dashDotDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9033
		x_dashes = dashDotDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9034
		x_nDash = sizeof(dashDotDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9035
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9036
	    } else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9037
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9038
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9039
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9040
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9041
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9042
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9043
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9044
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9045
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9046
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9047
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9048
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9049
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9050
	    if (x_dashes) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9051
		XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash);
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
	    XSetLineAttributes(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9054
			       __GCVal(aGCId), __intVal(aNumber),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9055
			       x_style, x_cap, x_join);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9056
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9057
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9058
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9059
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9060
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9061
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9062
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9063
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9064
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9065
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9066
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9067
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9068
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9069
    self primitiveFailedOrClosedConnection
295
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9072
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9073
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9074
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9075
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9076
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9077
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9078
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9079
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9080
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9081
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9082
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9083
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9084
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9085
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9086
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9087
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9088
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9089
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9090
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9091
    "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
  9092
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9093
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9094
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9095
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9096
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9097
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9098
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9099
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9100
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9101
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9102
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9103
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9104
	    if (__isExternalAddress(aPixmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9105
		pixmap = __PixmapVal(aPixmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9106
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9107
		XSetTile(dpy, gc, pixmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9108
		XSetFillStyle(dpy, gc, FillTiled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9109
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9110
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9111
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9112
	    if (aPixmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9113
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9114
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9115
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9116
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9117
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9118
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9119
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9120
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9121
    self primitiveFailedOrClosedConnection
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9122
!
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9123
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9124
setPlaneMask:bits in:aGCId
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9125
    "set foreground color to be drawn with"
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9126
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9127
    <context: #return>
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9128
%{
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9129
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9130
	if (__isExternalAddress(aGCId)
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9131
	 && __isSmallInteger(bits)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9132
	    unsigned long mask = __intVal(bits);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9133
	    if (__intVal(bits) == -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9134
		mask = AllPlanes;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9135
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9136
	    ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9137
	    XSetPlaneMask(myDpy, __GCVal(aGCId), mask);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9138
	    LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9139
	    RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9140
	}
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9141
    }
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9142
%}.
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9143
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9144
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9145
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  9146
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9147
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9148
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9149
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9150
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9151
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9152
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9153
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9154
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9155
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  9156
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9157
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9158
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9159
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9160
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9161
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9162
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9163
	XCloseDisplay(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9164
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9165
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9166
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9167
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9168
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9169
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9170
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9171
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9172
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9173
%{
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9174
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9175
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9176
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9177
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9178
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9179
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9180
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9181
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9182
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9183
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9184
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9185
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9186
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9187
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9188
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9189
getWindowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9190
    "Creates a fake WindowGroup view. This window is used
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9191
     in XWMHints & _NET_WM_LEADER properties to define
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9192
     application window group"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9193
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9194
    windowGroupWindow isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9195
	windowGroupWindow := WindowGroupWindow new create.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9196
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9197
    ^ windowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9198
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9199
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9200
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  9201
    activateOnClick := false.
6156
dd328de0a324 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6154
diff changeset
  9202
    maxOperationsUntilFlush := nil.
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  9203
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  9204
    super initializeDefaultValues.
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9205
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9206
    "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
  9207
    Even on 2-button mouse (button 2 is simply not reported).
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9208
    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
  9209
    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
  9210
    is somewhat special value.
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9211
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9212
    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
  9213
    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
  9214
7478
4865dd2c05c9 #OTHER by mawalch
mawalch
parents: 7443
diff changeset
  9215
    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
  9216
    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
  9217
    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
  9218
    "
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9219
6092
92572b3d40ea you shalt not modify literal arrays
Claus Gittinger <cg@exept.de>
parents: 6064
diff changeset
  9220
    buttonTranslation := buttonTranslation copy.
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9221
    buttonTranslation at: 2 put: #paste
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9222
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9223
    "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
  9224
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9225
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9226
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9227
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9228
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  9229
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  9230
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9231
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9232
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9233
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9234
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9235
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9236
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9237
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9238
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9239
     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
  9240
     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
  9241
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9242
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9243
    displayId notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9244
	"/ already connected - you bad guy try to trick me manually ?
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9245
	^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9246
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9247
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9248
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9249
    displayId isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9250
	"/ could not connect.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9251
	DeviceOpenErrorSignal raiseWith:aDisplayName.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9252
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9253
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9254
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9255
    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9256
    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  9257
    hasConnectionBroken := false.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9258
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9259
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9260
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9261
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9262
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9263
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9264
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9265
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9266
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9267
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9268
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9269
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9270
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9271
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9272
    atoms := nil.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9273
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9274
    "These values are initialized by primitive code in #createWindowFor:..."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9275
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9276
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9277
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9278
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9279
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9280
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9281
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9282
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9283
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9284
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9285
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9286
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9287
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9288
    Screen default isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9289
	"not initialized yet?"
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9290
	self initializeViewStyle.
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9291
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9292
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9293
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9294
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9295
    "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
  9296
     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
  9297
     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
  9298
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9299
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9300
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9301
    super initializeModifierMappings.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9302
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9303
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9304
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9305
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9306
    map isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9307
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9308
	"/ mhmh - a crippled Xlib which does not provide modifier mappings
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9309
	"/ setup some reasonable default. If that is not sufficient,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9310
	"/ you have to change things from your display.rc file.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9311
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9312
	altModifierMask := self modifier1Mask.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9313
	metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9314
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9315
	| mod symbolFromKeyCode nonNilOnes |
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
	altModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9318
	metaModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9319
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9320
	symbolFromKeyCode := [:key | self symbolFromKeycode:key].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9321
	nonNilOnes := [:str | str notNil].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9322
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9323
	mod := map at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9324
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9325
	    shiftModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9326
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9327
	mod := map at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9328
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9329
	    ctrlModifiers  := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9330
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9331
	mod := map at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9332
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9333
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9334
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9335
		metaModifiers := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9336
		metaModifierMask := 1 bitShift:(4-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9337
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9338
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9339
	mod := map at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9340
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9341
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9342
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9343
		altModifiers   := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9344
		altModifierMask := 1 bitShift:(5-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9345
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9346
	]
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9347
    ].
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9348
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9349
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9350
     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
  9351
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9352
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9353
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9354
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9355
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9356
initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9357
    self isXineramaActive ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9358
	|rect|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9359
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9360
	self monitorBounds do:[:eachRect|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9361
	    rect isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9362
		rect := eachRect.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9363
	    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9364
		rect := rect merge:eachRect.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9365
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9366
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9367
	width := rect width.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9368
	height := rect height.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9369
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9370
	"propagate possible size changes to our rottView"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9371
	rootView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9372
	    rootView initialize.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9373
	].
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9374
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9375
	width := self queryWidth.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9376
	height := self queryHeight.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9377
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9378
    widthMM := self queryWidthMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9379
    heightMM := self queryHeightMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9380
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9381
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9382
      Display initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9383
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9384
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9385
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9386
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9387
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9388
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9389
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9390
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9391
    hasShapeExtension := self hasExtension:#SHAPE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9392
    hasShmExtension := self hasExtension:#MIT_SHM.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9393
    hasDPSExtension := self hasExtension:#DPS.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9394
    hasXVideoExtension := self hasExtension:#XVideo.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9395
    hasMbufExtension := self hasExtension:#'Multi-Buffering'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9396
    hasPEXExtension := self hasExtension:#'X3D-PEX'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9397
    hasImageExtension := self hasExtension:#XIE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9398
    hasInputExtension := self hasExtension:#XInputExtension.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9399
    hasXineramaExtension := self hasExtension:#XINERAMA.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9400
    hasRenderExtension := self hasExtension:#RENDER.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9401
    hasXftLibrary := hasRenderExtension and:[self class hasXftLibrary].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9402
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9403
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9404
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9405
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9406
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9407
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9408
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9409
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9410
    screen := self queryDefaultScreen.
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9411
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9412
    self initializeScreenBounds.
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9413
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9414
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9415
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9416
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9417
    whitepixel := self queryWhitePixel.
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
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9420
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9421
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9422
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9423
    (visualType == #StaticGray
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9424
     or:[ visualType == #GrayScale]) ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9425
	hasColors := false.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9426
	monitorType := #monochrome.
3214
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
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9429
    ncells == 2 ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9430
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9431
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9432
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9433
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9434
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9435
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9436
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9437
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9438
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9439
    visualType == #TrueColor ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9440
	redShift := redMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9441
	greenShift := greenMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9442
	blueShift := blueMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9443
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9444
	bitsRed := redMask highBit - redMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9445
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9446
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
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
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  9449
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9450
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9451
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9452
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9453
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9454
    XVisualInfo viproto;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9455
    XVisualInfo *vip;                   /* returned info */
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9456
    int maxRGBDepth, maxRGBADepth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9457
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9458
    int rgbaRedMask, rgbaGreenMask, rgbaBlueMask, rgbaAlphaMask;
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9459
    int rgbVisualID, rgbaVisualID;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9460
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9461
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9462
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9463
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9464
    if (ISCONNECTED) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9465
	dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9466
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9467
	/*
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9468
	 * look for RGB visual with the highest depth
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9469
	 */
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9470
	nvi = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9471
	viproto.screen = scr;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9472
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9473
	maxRGBDepth = maxRGBADepth = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9474
	for (i = 0; i < nvi; i++) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9475
	    int thisDepth = vip[i].depth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9476
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9477
	    switch (vip[i].class) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9478
		case TrueColor:
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9479
		    if (thisDepth > maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9480
			if (thisDepth <= 24) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9481
			    maxRGBDepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9482
			    rgbRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9483
			    rgbGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9484
			    rgbBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9485
			    rgbVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9486
			} else {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9487
			    if (thisDepth > maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9488
				// printf("found rgba visual!\n");
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9489
				maxRGBADepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9490
				rgbaRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9491
				rgbaGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9492
				rgbaBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9493
				rgbaVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9494
			    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9495
			}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9496
		    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9497
		    break;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9498
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9499
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9500
	if (vip) XFree ((char *) vip);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9501
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9502
	if (maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9503
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9504
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9505
	if (maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9506
	    __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9507
	    if (!maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9508
		__INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9509
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9510
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9511
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9512
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9513
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9514
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9515
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9516
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9517
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9518
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9519
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9520
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9521
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9522
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9523
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9524
    (self serverVendor = 'X11/NeWS') ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9525
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9526
	"/ 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
  9527
	"/ which does not correctly handle saveUnder
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9528
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9529
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9530
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9531
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9532
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9533
initializeUniqueID
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9534
    uniqueDeviceID isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9535
	uniqueDeviceID := UUID genUUID.
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9536
    ]
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9537
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9538
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9539
invalidateConnection
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9540
    super invalidateConnection.
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9541
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9542
    "the new display may support a different set of fonts"
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9543
    self flushListOfAvailableFonts
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9544
!
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9545
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9546
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9547
    "open a connection to some display;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9548
     return the displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9549
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  9550
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9551
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9552
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9553
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9554
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  9555
    if (__isStringLike(dpyName))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9556
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9557
    else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9558
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9559
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9560
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9561
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9562
    if (dpy) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9563
	static int firstCall = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9564
	OBJ dpyID;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9565
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9566
	dpyID = __MKEXTERNALADDRESS(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9567
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9568
	if (firstCall) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9569
	    firstCall = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9570
	    XSetErrorHandler(__XErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9571
	    XSetIOErrorHandler(__XIOErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9572
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9573
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9574
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9575
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9576
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9577
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9578
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9579
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9580
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9581
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9582
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9583
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9584
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9585
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9586
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9587
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9588
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9589
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9592
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9593
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9594
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9595
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9596
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9597
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9598
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9599
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9600
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9601
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9602
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9603
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9604
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9605
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9606
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9607
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9608
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9611
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9612
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9613
     Display queryCells
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9614
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9615
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9616
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9617
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9618
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9619
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9620
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9621
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9622
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9623
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9624
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
3487
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
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9627
    ^ nil
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
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9630
     Display queryDefaultScreen
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9631
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9632
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9633
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9634
queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9635
%{  /* NOCONTEXT */
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9636
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9637
    if (ISCONNECTED) {
6762
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9638
	Display *dpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9639
	Visual *visual;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9640
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9641
	dpy = myDpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9642
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9643
	RETURN ( __MKEXTERNALADDRESS( visual ) );
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9644
    }
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
    ^ nil
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9647
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9648
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9649
     Display queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9650
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9651
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9652
    "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
  9653
!
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9654
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9655
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9656
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9657
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9658
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9659
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9660
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9661
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9662
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9663
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9664
	switch (visual->class) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9665
	    case StaticGray:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9666
		RETURN ( @symbol(StaticGray) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9667
	    case GrayScale:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9668
		RETURN ( @symbol(GrayScale) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9669
	    case StaticColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9670
		RETURN ( @symbol(StaticColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9671
	    case PseudoColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9672
		RETURN ( @symbol(PseudoColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9673
	    case TrueColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9674
		RETURN ( @symbol(TrueColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9675
	    case DirectColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9676
		RETURN ( @symbol(DirectColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9677
	}
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9678
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9679
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9680
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9681
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9682
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9683
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9684
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9685
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9686
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9687
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9688
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9689
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9690
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9691
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9692
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9693
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9694
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9695
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9696
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9697
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9700
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9701
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9702
     Display queryDepth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9703
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9704
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9705
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9706
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9707
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9708
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9709
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9710
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9711
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9712
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9713
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9714
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9715
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9716
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9719
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9720
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9721
     Display queryHeight
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9722
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9723
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9724
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9725
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9726
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9727
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9728
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9729
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9730
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9731
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9732
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9733
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9734
	RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9735
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9738
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9739
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9740
     Display queryHeightMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9741
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9742
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9743
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9744
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9745
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9746
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9747
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9748
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9749
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9750
	OBJ redMask, greenMask, blueMask, bprgb;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9751
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9752
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9753
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9754
	redMask   = __MKSMALLINT(visual->red_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9755
	greenMask = __MKSMALLINT(visual->green_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9756
	blueMask  = __MKSMALLINT(visual->blue_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9757
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9758
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9759
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9760
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9761
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9762
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9763
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9764
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9765
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9766
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9767
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9768
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9769
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9770
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9771
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9772
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9773
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9774
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9775
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9776
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9777
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9778
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9781
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9782
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9783
     Display queryWhitePixel
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9784
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9785
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9786
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9787
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9788
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9789
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9790
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9791
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9792
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9793
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9794
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9795
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9796
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9797
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9800
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9801
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9802
     Display queryWidth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9803
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9804
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9805
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9806
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9807
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9808
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9809
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9810
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9811
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9812
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9813
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9814
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9815
	RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9816
    }
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
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9819
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9820
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9821
     Display queryWidthMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9822
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9823
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9824
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9825
reinitialize
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9826
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9827
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9828
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9829
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9830
    virtualRootId := rootId := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9831
    selectionFetchers := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9832
    dispatchingExpose := nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9833
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9834
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9835
releaseDeviceResources
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9836
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9837
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9838
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9839
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9840
    selectionFetchers := nil.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9841
    super releaseDeviceResources.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9842
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9843
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9844
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9845
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9846
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9847
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9848
     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
  9849
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9850
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9851
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9852
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9853
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9854
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9855
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9856
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9857
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9858
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9859
     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
  9860
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9861
     and the setting can be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9862
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9863
     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
  9864
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9865
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9866
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9867
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9868
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9869
appleAltModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9870
    "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
  9871
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9872
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9873
    OperatingSystem isOSXlike ifTrue:[
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9874
        ^ 8192
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9875
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9876
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9877
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9878
    "Created: / 10-02-2017 / 21:32:13 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9879
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9880
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9881
appleCmdModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9882
    "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
  9883
     Nil returned for other displays"
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
    OperatingSystem isOSXlike ifTrue:[
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9886
        ^ 16
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9887
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9888
    ^ nil
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
    "Created: / 10-02-2017 / 21:32:50 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9891
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9892
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9893
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9894
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9895
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9896
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9897
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9898
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9899
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9900
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9901
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9902
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9903
     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
  9904
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9905
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9906
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9907
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9908
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9909
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9910
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9911
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9912
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9913
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9914
     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
  9915
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9916
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9917
     be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9918
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9919
     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
  9920
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9921
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9922
     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
  9923
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9924
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9925
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9926
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9927
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9928
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9929
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9930
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9931
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9932
     this could be used."
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
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9935
    RETURN (__MKSMALLINT(Mod1Mask));
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
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9938
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9939
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9940
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9941
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9942
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9943
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9944
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9945
    RETURN (__MKSMALLINT(Mod2Mask));
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
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9948
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9949
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9950
    "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
  9951
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9952
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9953
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9954
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9955
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9956
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9957
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9958
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9959
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9960
    "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
  9961
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9962
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9963
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9964
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9965
    RETURN (__MKSMALLINT(Mod4Mask));
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
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9969
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9970
    "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
  9971
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9972
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9973
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9974
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  9975
    RETURN (__MKSMALLINT(Mod5Mask));
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9979
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9980
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9981
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9982
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9983
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9984
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9985
    modifierKeyMap := self rawModifierMapping.
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
  9986
    modifierKeyMap isEmptyOrNil ifTrue:[^ nil].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9987
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9988
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9989
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9990
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9991
    1 to:8 do:[ :i |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9992
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9993
	    |mod|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9994
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9995
	    mod := OrderedCollection new:maxKeyPerMod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9996
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9997
		key ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9998
		    mod add:key
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9999
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10000
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10001
	    ret at:i put:mod asArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10002
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10003
	nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10004
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10005
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10006
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10007
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10008
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10009
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10010
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10011
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10012
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10013
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10014
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10015
     mapping := Display modifierMapping.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10016
     ^ mapping collect:[:eachRow |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10017
			     eachRow notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10018
				 eachRow collect:[ :key | Display stringFromKeycode:key ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10019
			     ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10020
				 nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10021
			     ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10022
		       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10023
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10024
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10025
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10026
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10027
    "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
 10028
     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
 10029
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10030
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10031
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
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10035
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10036
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10037
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10038
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10039
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10040
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
 10041
    |modifierKeyMap|
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10042
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10043
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10044
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10045
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10046
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10047
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10048
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10049
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10050
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10051
	   if (modifierKeyMap != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10052
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10053
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10054
	   }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10055
	   XFreeModifiermap(modmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10056
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10057
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10058
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10059
    ^ modifierKeyMap
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10060
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10061
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10062
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10063
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10064
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10065
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10066
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10067
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10068
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10069
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10070
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10071
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10072
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10073
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10074
superModifierMask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10075
    "return the Xlib mask bit for the super modifier key"
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10076
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10077
    ^ self modifier4Mask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10078
!
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10079
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10080
symbolFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10081
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10082
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10083
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10084
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10085
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10086
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10087
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10088
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10089
    if (ISCONNECTED && __isSmallInteger(code)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10090
	Display *dpy = myDpy;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10091
5983
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10092
// Our Windows Xlib does not support Xkb as of 2013-01
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10093
//        if ((keysym = XkbKeycodeToKeysym(dpy, __intVal(code), 0, 0)) != NoSymbol
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10094
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10095
	    && (keystring = XKeysymToString(keysym)) != 0)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10096
	    str = __MKSYMBOL(keystring, 0);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10097
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10098
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10099
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10100
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10101
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10102
	Display symbolFromKeycode:50
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10103
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10104
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10105
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10106
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10107
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10108
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10109
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10110
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10111
    UserPreferences current beepEnabled ifTrue:[
6762
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
 10112
	self beep:0 volume:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
 10113
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10114
6758
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10115
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10116
     Screen current beep
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10117
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10118
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10119
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10120
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10121
5247
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10122
beep:aSymbolOrInteger volume:volumeInPercent
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10123
    "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
 10124
     (kept for comaptibilty with WinWorkstation)."
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10125
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10126
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10127
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10128
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10129
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10130
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10131
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10132
	/* stupid: X wants -100 .. 100 and calls this percent */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10133
	volume = __intVal(volumeInPercent) * 2 - 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10134
	if (volume < -100) volume = -100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10135
	else if (volume > 100) volume = 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10136
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10137
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10138
	XBell(myDpy, volume);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10139
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10140
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10141
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10142
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10143
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10144
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10145
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10146
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10147
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10148
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10149
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10150
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10151
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10152
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10153
	XSynchronize(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10154
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10155
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10156
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10157
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10158
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10159
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10160
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10161
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10162
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10163
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10164
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10165
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10166
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10167
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10168
     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
 10169
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10170
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10171
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10172
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10173
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10174
	XFlush(myDpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10175
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10176
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10177
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10178
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10179
    operationsUntilFlush := maxOperationsUntilFlush.
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10180
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10181
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10182
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10183
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10184
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10185
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10186
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10187
	&& __isExternalAddress(aDPSContext)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10188
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10189
	DPSFlushContext(__DPSContextVal(aDPSContext));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10190
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10191
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10192
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10193
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10194
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10195
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10196
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10197
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10198
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10199
flushIfAppropriate
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10200
    "flush the device, if necessary"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10201
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10202
    operationsUntilFlush notNil ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10203
	operationsUntilFlush <= 0 ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10204
	    self flush.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10205
	    ^ true.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10206
	] ifFalse:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10207
	    operationsUntilFlush := operationsUntilFlush - 1.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10208
	].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10209
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10210
    ^ false.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10211
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10212
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10213
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10214
    "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
 10215
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10216
     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
 10217
     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
 10218
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10219
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10220
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10221
%{
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10222
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10223
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10224
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10225
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10226
	XSync(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10227
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10228
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10229
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10230
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10231
    operationsUntilFlush := maxOperationsUntilFlush.
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10232
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10233
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10234
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10235
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10236
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10237
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10238
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10239
    if (ISCONNECTED && __isByteArrayLike(eB)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10240
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10241
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10242
	XRefreshKeyboardMapping(ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10243
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10244
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10245
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10246
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10247
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10248
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10249
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10250
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10251
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10252
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10253
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10254
    self sync.
4119
a770b7e08c72 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4114
diff changeset
 10255
    ^ Timestamp millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10256
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10257
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10258
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10259
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10260
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10261
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10262
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10263
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10264
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10265
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10266
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10267
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10268
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10269
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10270
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10271
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10272
     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
 10273
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10274
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10275
     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
 10276
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10277
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10278
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10279
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10280
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10281
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10282
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10283
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10284
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10285
	    focusWindow = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10286
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10287
	    focusWindow = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10288
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10289
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10290
	if (revertSymbol == @symbol(parent))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10291
	    arg = RevertToParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10292
	else if (revertSymbol == @symbol(root))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10293
	    arg = RevertToPointerRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10294
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10295
	    arg = RevertToNone;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10296
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10297
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10298
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10299
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10300
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10301
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10302
	RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10303
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10304
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10305
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10306
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10307
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10308
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10309
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10310
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10311
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10312
     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
 10313
     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
 10314
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10315
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10316
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10317
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10318
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10319
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10320
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10321
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10322
     This makes all graphics synchronous and turns off any buffering
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10323
     (i.e. each individual draw-request is sent immediately without
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10324
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10325
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10326
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10327
     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
 10328
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10329
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10330
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10331
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10332
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10333
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10334
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10335
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10336
	XSynchronize(myDpy, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10337
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10338
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10339
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10340
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10341
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10342
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10343
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10344
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10345
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10346
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10347
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10348
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10349
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10350
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10351
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10352
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10353
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10354
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10355
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10356
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10357
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10358
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10359
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10360
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10361
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10362
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10363
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10364
     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
 10365
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10366
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10367
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10368
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10369
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10370
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10371
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10372
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10373
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10374
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10375
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10376
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10377
	w = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10378
	if (w) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10379
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10380
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10381
	    XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10382
				 &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10383
				 &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10384
				 &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10385
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10386
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10387
	    RETURN (__MKSMALLINT(mask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10388
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10389
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10390
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10391
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10392
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10393
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10394
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10395
     Display buttonStates
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10396
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10397
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10398
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10399
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10400
     Display buttonStates bitTest:(Display controlMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10401
    "
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
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10404
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10405
     Display buttonStates bitTest:(Display altModifierMask)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10406
     Display buttonStates bitTest:(Display metaModifierMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10407
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10408
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10409
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10410
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10411
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10412
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10413
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10414
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10415
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10416
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10417
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10418
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10419
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10420
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10421
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10422
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10423
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10424
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10425
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10426
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10427
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10428
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10429
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10430
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10431
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10432
pointerPosition
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10433
    "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
 10434
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10435
    <context: #return>
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10436
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10437
    |xpos ypos rootWindowId|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10438
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10439
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10440
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10441
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10442
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10443
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10444
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10445
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10446
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10447
    if (ISCONNECTED && rootWindowId != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10448
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10449
	Window w = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10450
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10451
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10452
	XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10453
			      &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10454
			      &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10455
			      &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10456
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10457
	xpos = __MKSMALLINT(rootX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10458
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10459
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10460
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10461
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10462
    xpos isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10463
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10464
	^ nil
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10465
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10466
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10467
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10468
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10469
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10470
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10471
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10472
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10473
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10474
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10475
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10476
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10477
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10478
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10479
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10480
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10481
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10482
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10483
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10484
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10485
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10486
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10487
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10488
    "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
 10489
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
 10490
     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
 10491
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10492
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10493
     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
 10494
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10495
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10496
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10497
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10498
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10499
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10500
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10501
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10502
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10503
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10504
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10505
     && __bothSmallInteger(xpos, ypos)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10506
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10507
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10508
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10509
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10510
	XWarpPointer(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10511
		     None,  /* src window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10512
		     w,  /* dst window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10513
		     0,  /* src_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10514
		     0,  /* src_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10515
		     0,  /* src_w */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10516
		     0,  /* src_h */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10517
		     __intVal(xpos),  /* dst_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10518
		     __intVal(ypos)   /* dst_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10519
		    );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10520
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10521
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10522
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10523
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10524
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10525
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10526
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10527
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10528
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10529
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10530
!XWorkstation methodsFor:'private'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10531
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10532
addSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10533
    "register someone to be notified when the selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10534
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10535
    selectionHandlers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10536
	selectionHandlers := IdentitySet new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10537
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10538
    selectionHandlers add:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10539
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10540
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10541
findSelectionFetcher:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10542
    "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
 10543
     Answer nil, if there is none"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10544
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10545
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10546
	^ nil.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10547
    ].
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
    ^ selectionFetchers at:aDrawableId ifAbsent:[].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10550
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10551
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10552
registerSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10553
    "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
 10554
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10555
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10556
	selectionFetchers := Dictionary new.
6157
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
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10559
    selectionFetchers at:aSelectionFetcher drawableID put:aSelectionFetcher.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10560
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10561
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10562
removeSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10563
    "no longer tell someone about selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10564
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10565
    selectionHandlers notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10566
	selectionHandlers remove:someone ifAbsent:nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10567
	selectionHandlers := selectionHandlers asNilIfEmpty
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10568
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10569
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10570
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10571
unregisterSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10572
    "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
 10573
8053
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10574
    selectionFetchers removeKey:(aSelectionFetcher drawableID) ifAbsent:[].
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10575
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10576
    "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
 10577
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10578
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10579
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10580
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10581
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10582
    "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
 10583
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10584
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10585
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10586
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10587
    if (ISCONNECTED && __isAtomID(propertyID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10588
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10589
	Atom prop;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10590
	Window window;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10591
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10592
	prop = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10593
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10594
	if (__isExternalAddress(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10595
	    window = __WindowVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10596
	} else if (aWindowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10597
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10598
	} else if (__isInteger(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10599
	    window = (Window)__unsignedLongIntVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10600
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10601
	    goto fail;
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10604
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10605
	XDeleteProperty(dpy, window, prop);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10606
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10607
	RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10608
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10609
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10610
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10611
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10612
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10613
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10614
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10615
    "get a property as an association propertyType->propertyValue"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10616
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10617
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10618
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10619
    |val typeID propertyID windowID|
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10620
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10621
    propertySymbolOrAtomID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10622
	propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10623
	propertyID isNil ifTrue:[^ nil].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10624
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10625
	propertyID := propertySymbolOrAtomID.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10626
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10627
    aWindowOrWindowIDOrNil isView ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10628
	windowID := aWindowOrWindowIDOrNil id.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10629
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10630
	windowID := aWindowOrWindowIDOrNil.
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10631
    ].
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10632
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10633
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10634
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10635
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10636
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10637
    Atom actual_type;
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10638
    int actual_format;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10639
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10640
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10641
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10642
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10643
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10644
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10645
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10646
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10647
	if (__isAtomID(propertyID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10648
	    property = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10649
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10650
	    if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10651
		window = __WindowVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10652
	    } else if (windowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10653
		window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10654
	    } else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10655
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10656
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10657
	    nread = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10658
	    cp = 0;
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10659
#ifdef PROPERTY_DEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10660
	    console_fprintf(stderr, "getProperty %x\n", property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10661
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10662
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10663
	    do {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10664
		int retVal;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10665
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10666
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10667
		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10668
					    doDelete == true,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10669
					    AnyPropertyType, &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10670
					    &nitems, &bytes_after, (unsigned char **)&data);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10671
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10672
		if (retVal != Success) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10673
#ifdef PROPERTY_DEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10674
		    console_fprintf(stderr, "- no success\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10675
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10676
		    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10677
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10678
		}
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10679
#ifdef PROPERTY_DEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10680
		console_fprintf(stderr, "- type:%x\n", actual_type);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10681
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10682
		nitems *= (actual_format / 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10683
		typeID = __MKATOMOBJ(actual_type);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10684
		if (! cp) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10685
		    cp = cp2 = (char *)malloc(nitems+bytes_after);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10686
		} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10687
		    cp2 = cp + nread;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10688
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10689
		if (! cp) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10690
		    XFree(data);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10691
		    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10692
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10693
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10694
		nread += nitems;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10695
		bcopy(data, cp2, nitems);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10696
		XFree(data);
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10697
#ifdef PROPERTY_DEBUG
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10698
		console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10699
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10700
	    } while (bytes_after > 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10701
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10702
	    if (ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10703
		switch (actual_format) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10704
		case 32:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10705
		    val = __stArrayFromCUIntArray((unsigned int*)cp, nread/4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10706
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10707
		case 16:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10708
		    val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10709
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10710
		case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10711
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10712
		    if (actual_type == XA_STRING) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10713
			val = __MKSTRING_L(cp, nread);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10714
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10715
			val = __MKBYTEARRAY(cp, nread);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10716
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10717
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10718
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10719
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10720
	    if (cp)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10721
		free(cp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10722
	}
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10723
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10724
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10725
%}.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 10726
    (typeID isNil or:[typeID == 0]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10727
	"typeID == 0 (None): The property does not exist in the specified window"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10728
	^ nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10729
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10730
    ^ typeID->val
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
 10731
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
 10732
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10733
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10734
	getProperty:#'_NET_WM_ICON_GEOMETRY'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10735
	from:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10736
	delete:false
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10737
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10738
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10739
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10740
propertiesOf:aWindowOrWindowIDOrNil
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10741
    "return a collection of all properties' atomIDs of a window.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10742
     Returns the rootWindows props for a nil window argument."
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10743
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10744
    <context: #return>
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10745
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10746
    |windowID atoms|
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10747
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10748
    aWindowOrWindowIDOrNil isView ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10749
	windowID := aWindowOrWindowIDOrNil id.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10750
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10751
	windowID := aWindowOrWindowIDOrNil.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10752
    ].
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10753
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10754
%{
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10755
    Window window;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10756
    Atom *atomListPtr;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10757
    int i;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10758
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10759
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10760
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10761
	int numProps = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10762
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10763
	if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10764
	    window = __WindowVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10765
	} else if (windowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10766
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10767
	} else if (__isInteger(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10768
	    window = (Window)__unsignedLongIntVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10769
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10770
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10771
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10772
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10773
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10774
	atomListPtr = XListProperties(dpy, window, &numProps);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10775
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10776
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10777
	if (atomListPtr == NULL) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10778
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10779
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10780
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10781
	atoms = __ARRAY_NEW_INT(numProps);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10782
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10783
	if (atoms == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10784
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10785
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10786
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10787
	for (i=0; i<numProps; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10788
	    OBJ atm;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10789
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10790
	    atm = __MKATOMOBJ(atomListPtr[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10791
	    __ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10792
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10793
	XFree(atomListPtr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10794
	RETURN (atoms);
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10795
    }
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10796
fail: ;
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10797
%}.
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10798
    ^ self primitiveFailed
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10799
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10800
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10801
     Display propertiesOf:nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10802
     Display propertiesOf:Transcript view id
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10803
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10804
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10805
     (Display propertiesOf:nil) do:[:atm |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10806
	|v prop|
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
	Transcript show:((Display atomName:atm) printStringLeftPaddedTo:5).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10809
	Transcript show:': '.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10810
	prop := Display getProperty:atm from:nil delete:false.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10811
	Transcript showCR:prop value.
3975
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10812
     ]
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10813
    "
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10814
!
e8dfa0e5ba1b + propertiesOf:
Claus Gittinger <cg@exept.de>
parents: 3974
diff changeset
 10815
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10816
setIcon:anIcon for:aWindowID
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10817
    |iconAtom typeAtom buffer iWidth iHeight|
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10818
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10819
    iconAtom := self atomIDOf:#'_NET_WM_ICON' create:false.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10820
    iconAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10821
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10822
	^ self
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10823
    ].
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10824
    typeAtom := self atomIDOf:#'CARDINAL' create:false.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10825
    typeAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10826
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10827
	^ self
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10828
    ].
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10829
    iWidth  := anIcon width.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10830
    iHeight := anIcon height.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10831
    buffer := IntegerArray new:(iWidth*iHeight+2).
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10832
    buffer at:1 put:iWidth.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10833
    buffer at:2 put:iHeight.
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10834
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10835
    self setProperty:iconAtom type:typeAtom value:buffer for:aWindowID
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10836
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10837
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10838
	Display setIcon:0 for:0
5934
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10839
    "
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10840
!
456535dcca66 added: #setIcon:for:
Stefan Vogel <sv@exept.de>
parents: 5928
diff changeset
 10841
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10842
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10843
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10844
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10845
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 10846
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10847
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10848
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10849
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10850
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10851
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10852
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10853
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10854
	Atom prop, type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10855
	Window window;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10856
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10857
	prop = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10858
	type = __AtomVal(typeID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10860
	if (__isExternalAddress(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10861
	    window = __WindowVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10862
	} else if (aWindowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10863
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10864
	} else if (__isInteger(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10865
	    window = (Window)__unsignedLongIntVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10866
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10867
	    RETURN(false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10868
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10869
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10870
	retval = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10871
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10872
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10873
	if (__isInteger(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10874
	    unsigned INT value = __longIntVal(anObject);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10875
	    XChangeProperty(dpy, window, prop, type, 32,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10876
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10877
			    (unsigned char *)&value, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10878
	} else if (__isByteArrayLike(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10879
	    XChangeProperty(dpy, window, prop, type, 8,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10880
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10881
			    __byteArrayVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10882
			    __byteArraySize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10883
	} else if (__isWords(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10884
	    /* wordArray-like (16bit-string) object */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10885
	    XChangeProperty(dpy, window, prop, type, 16,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10886
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10887
			    __stringVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10888
			    __wordArraySize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10889
	} else if (__isIntegerArray(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10890
	    /* array of atoms */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10891
	    XChangeProperty(dpy, window, prop, type, 32,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10892
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10893
			    (char *)__integerArrayVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10894
			    __integerArraySize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10895
	} else if (__isStringLike(anObject)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10896
	    XChangeProperty(dpy, window, prop, type, 8,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10897
			    PropModeReplace,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10898
			    __stringVal(anObject),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10899
			    __stringSize(anObject));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10900
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10901
	    retval = false;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10902
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10903
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10904
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10905
	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
 10906
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10907
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10908
    ^ retval
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10909
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10910
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10911
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10912
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10913
defaultExtentForTopViews
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10914
    "redefined, to define the default extent for the default monitor"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10915
    |extent|
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10916
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10917
    "the standard monitor is the first entry in monitorBounds"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10918
    extent := self monitorBounds first extent.
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10919
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10920
    self isPDA ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10921
	^ extent - (16 @ 20)
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10922
    ].
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10923
    ^ extent * 2 // 3
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10924
!
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 10925
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10926
isOpen
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10927
    "answer true, if device can be used"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10928
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10929
    ^ displayId notNil and:[hasConnectionBroken not].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10930
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10931
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10932
isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10933
%{  /* NOCONTEXT */
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10934
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10935
#ifdef XINERAMA
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10936
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10937
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10938
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10939
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10940
	if (XineramaIsActive(dpy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10941
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10942
	}
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10943
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10944
#endif
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10945
%}.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10946
    ^ false
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10947
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10948
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10949
     Display isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 10950
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10951
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10952
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10953
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10954
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10955
atomIDOf:aStringOrSymbol
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 10956
    "return an X11 atoms ID.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10957
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10958
     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
 10959
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10960
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10961
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10962
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10963
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10964
     Display atomIDOf:#'FACE_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10965
     Display atomIDOf:#'FULL_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10966
     Display atomIDOf:#DndProtocol
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10967
     Display atomIDOf:#DndSelection
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10968
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10969
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10970
    "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
 10971
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10972
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10973
atomIDOf:aStringOrSymbol create:create
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 10974
    "return an Atoms ID given its name.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 10975
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 10976
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 10977
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 10978
     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
 10979
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10980
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10981
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10982
    atomSymbol := aStringOrSymbol asSymbol.
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
 10983
    (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
 10984
	^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10985
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10986
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10987
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10988
    atom notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 10989
	atoms isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 10990
	    atoms := IdentityDictionary new.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 10991
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 10992
	atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10993
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10994
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10995
    ^ atom
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
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 10998
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 10999
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11000
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11001
     Display atomIDOf:'PRIMARY' create:false
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11002
     Display atomIDOf:'blabla' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11003
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11004
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11005
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11006
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11007
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11008
     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
 11009
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11010
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11011
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11012
%{
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11013
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11014
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11015
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11016
    if (ISCONNECTED && __isAtomID(anAtomID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11017
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11018
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11019
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11020
	if (name == 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11021
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11022
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11023
	str = __MKSTRING(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11024
	XFree(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11025
	RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11026
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11027
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11028
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11029
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11030
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11031
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11032
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11033
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11034
     Display atomName:132  'FONTNAME_REGISTRY'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11035
     Display atomName:135 'FOUNDRY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11036
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11037
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11038
     Display atomName:152 'CHARSET_ENCODING'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11039
     Display atomName:154
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11040
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11041
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11042
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11043
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11044
    "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
 11045
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11046
     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
 11047
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11048
     Notice:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11049
	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
 11050
	styles or resources. This would make porting of applications
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11051
	to different platforms much more difficult (Windows has no resource
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11052
	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
 11053
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11054
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11055
     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
 11056
     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
 11057
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11058
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11059
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11060
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11061
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11062
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11063
     && __isStringLike(name)
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11064
     && __isStringLike(cls)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11065
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11066
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11067
				  (char *) __stringVal(name));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11068
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11069
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11070
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11071
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11072
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11073
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11074
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11075
    "if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11076
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11077
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11078
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11079
	 Display getResource:'Beep' class:'OpenWindows'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11080
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11081
     if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11082
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11083
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11084
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11085
	 Display getResource:'beNiceToColormap' class:'any'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11086
	 Display getResource:'beNiceToColormap' class:''
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11087
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11088
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11089
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11090
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11091
    "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
 11092
     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
 11093
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11094
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11095
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11096
%{
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11097
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11098
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11099
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11100
     && __isStringLike(aStringOrSymbol)) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11101
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11102
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11103
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11104
				  (create == true) ? False : True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11105
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11106
	if (prop == None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11107
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11108
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11109
	RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11110
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11111
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11112
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11113
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11114
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11115
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11116
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11117
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11118
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11119
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11120
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11121
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11122
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11123
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11124
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
 11125
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
 11126
    "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
 11127
     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
 11128
     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
 11129
     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
 11130
     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
 11131
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11132
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11133
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11134
    ((w <= 0) or:[h <= 0]) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11135
	self primitiveFailed.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11136
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11137
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11138
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11139
    rawInfo := Array new:8.
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11140
		  "1 -> bit order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11141
		  "2 -> depth"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11142
		  "3 -> bytes_per_line"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11143
		  "4 -> byte_order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11144
		  "5 -> format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11145
		  "6 -> bitmap_unit"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11146
		  "7 -> bitmap_pad"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11147
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11148
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11149
    "/ 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
 11150
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11151
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11152
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11153
    (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
 11154
	info := IdentityDictionary new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11155
	info at:#bitOrder put:(rawInfo at:1).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11156
	info at:#depth put:(rawInfo at:2).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11157
	info at:#bytesPerLine put:(rawInfo at:3).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11158
	info at:#byteOrder put:(rawInfo at:4).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11159
	info at:#format put:(rawInfo at:5).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11160
	info at:#bitmapUnit put:(rawInfo at:6).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11161
	info at:#bitmapPad put:(rawInfo at:7).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11162
	info at:#bitsPerPixel put:(rawInfo at:8).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11163
	^ info
7506
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11164
    ].
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11165
    "
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11166
     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
 11167
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11168
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11169
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11170
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11171
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11172
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
 11173
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
 11174
    "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
 11175
     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
 11176
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11177
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11178
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11179
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11180
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11181
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11182
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11183
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11184
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11185
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11186
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11187
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11188
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11189
	xpos = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11190
	ypos = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11191
	if ((xpos < 0) || (ypos < 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11192
	    RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11193
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11194
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11195
	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11196
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11197
	if (img != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11198
	    ret = XGetPixel(img, 0, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11199
	    XDestroyImage(img);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11200
	    RETURN (  __MKSMALLINT(ret) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11201
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11202
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11203
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11204
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11205
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11206
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11207
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
 11208
    "since XGetImage may allocate huge amount of stack space
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11209
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11210
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11211
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11212
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11213
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11214
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11215
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11216
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11217
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11218
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11219
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11220
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11221
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11222
     && __bothSmallInteger(w, h)
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11223
     && __isArray(info) && (__arraySize(info) >= 8)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11224
     && __isByteArray(imageBits)) {
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11225
        Display *dpy = myDpy;
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11226
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11227
        win = __WindowVal(aDrawableId);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11228
        ENTER_XLIB();
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11229
        image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11230
                                    __intVal(w), __intVal(h),
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11231
                                    (unsigned)AllPlanes, ZPixmap);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11232
        LEAVE_XLIB();
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11233
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11234
        if (! image) {
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11235
            RETURN ( false );
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11236
        }
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11237
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11238
        pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11239
#ifdef SUPERDEBUG
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11240
        console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11241
#endif
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11242
        switch (image->depth) {
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11243
            case 1:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11244
            case 2:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11245
            case 4:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11246
            case 8:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11247
            case 16:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11248
            case 24:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11249
            case 32:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11250
                numBytes = image->bytes_per_line * image->height;
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11251
                break;
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11252
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11253
            default:
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11254
                /* unsupported depth ? */
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11255
                console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11256
                numBytes = image->bytes_per_line * image->height;
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11257
                break;
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11258
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11259
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11260
#ifdef SUPERDEBUG
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11261
        console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11262
#endif
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11263
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11264
        if (numBytes > __byteArraySize(imageBits)) {
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11265
            /* imageBits too small */
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11266
            console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11267
            console_fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11268
            console_fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n",
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11269
                                image->bitmap_pad, image->depth, image->bytes_per_line);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11270
            goto fail;
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11271
        }
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11272
        if (image->bitmap_bit_order == MSBFirst)
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11273
            __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11274
        else
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11275
            __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11276
        __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11277
        __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11278
        if (image->byte_order == MSBFirst)
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11279
            __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11280
        else
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11281
            __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11282
        if (image->format == XYBitmap)
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11283
            __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11284
        else if (image->format == XYPixmap)
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11285
            __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11286
        else if (image->format == ZPixmap)
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11287
            __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11288
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11289
        __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11290
        __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11291
        __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11292
        bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11293
        XDestroyImage(image);
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11294
        RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11295
    }
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11296
fail:
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11297
    if (image) {
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11298
        XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11299
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11300
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11301
    ^ false
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11302
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11303
    "Modified: / 11-04-2017 / 21:17:31 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11304
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11305
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11306
!XWorkstation methodsFor:'selection fetching'!
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 11307
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11308
getClipboardObjectFor:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11309
    "get the object selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11310
     Returns nil, if no selection is available.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11311
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11312
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11313
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11314
    |selectionOwnerWindowId selection|
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11315
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11316
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11317
    selectionOwnerWindowId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11318
	"no selection. There is the possibilty that one of our (modal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11319
	 views has been closed. Get the selection from the copyBuffer"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11320
	^ copyBuffer.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11321
    ].
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 11322
    selectionOwnerWindowId = selectionOwner ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11323
	"I still hold the selection, so return my locally buffered data"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11324
	^ 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
 11325
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11326
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11327
    drawableId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11328
	"sorry, cannot fetch a selection, if there is no drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11329
	 Should I borrow a drawableId from another window?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11330
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11331
	selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11332
	    requestSelection:clipboardAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11333
	    type:(self atomIDOf:#'ST_OBJECT')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11334
	    onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11335
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11336
	"/ should not happen
6064
1cc8b8daaff5 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
 11337
false ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11338
	"/ 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
 11339
	selection isEmptyOrNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11340
	    selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11341
		requestSelection:clipboardAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11342
		type:(self atomIDOf:#'UTF8_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11343
		onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11344
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11345
	    selection isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11346
		selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11347
		    requestSelection:clipboardAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11348
		    type:(self atomIDOf:#STRING)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11349
		    onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11350
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11351
	].
6064
1cc8b8daaff5 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
 11352
].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11353
    ].
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
 11354
    selection isEmptyOrNil ifTrue:[ ^ copyBuffer ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11355
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11356
    ^ selection.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11357
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11358
    "
5928
a06ebbe0d07a comment/format in: #getClipboardObjectFor:
Stefan Vogel <sv@exept.de>
parents: 5914
diff changeset
 11359
       Display getClipboardObjectFor:Transcript id
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11360
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11361
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11362
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11363
getClipboardText:selectionBufferSymbol for:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11364
    "get the text selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11365
     Returns nil, if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11366
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11367
    |selectionId selectionOwnerWindowId selection|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11368
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11369
    selectionBufferSymbol == #selection ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11370
	selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11371
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11372
	selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11373
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11374
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11375
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11376
    selectionOwnerWindowId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11377
	"no selection. There is the possibilty that one of our (modal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11378
	 views has been closed. Get the selection from the copyBuffer"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11379
	^ self copyBufferAsString.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11380
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11381
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 11382
    selectionOwnerWindowId = selectionOwner ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11383
	"I still hold the selection, so return my locally buffered data"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11384
	"JV@2012-04-02: Added support for PRIMARY/SELECTION buffers."
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11385
	^ selectionId == primaryAtom ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11386
	    self primaryBufferAsString
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11387
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11388
	    self copyBufferAsString.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11389
	]
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
 11390
    ].
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11391
962f39074c53 Do not try to fetch a X11 selection (clipboard) into a window without drawableId
Stefan Vogel <sv@exept.de>
parents: 4723
diff changeset
 11392
    drawableId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11393
	"sorry, cannot fetch a selection, if there is no drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11394
	 Should I borrow a drawableId from another window?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11395
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11396
	selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11397
	    requestSelection:selectionId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11398
	    type:(self atomIDOf:#'UTF8_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11399
	    onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11400
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11401
	selection isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11402
	    selection := SelectionFetcher
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11403
		requestSelection:selectionId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11404
		type:(self atomIDOf:#STRING)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11405
		onDevice:self for:drawableId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11406
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11407
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11408
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11409
    ^ selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11410
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11411
     "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11412
       Display getTextSelection:#clipboard for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11413
       Display getTextSelection:#selection for:Transcript id
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11414
     "
5899
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11415
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11416
    "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
 11417
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11418
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11419
!XWorkstation methodsFor:'selection sending'!
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11420
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11421
selectionBuffer:bufferGetSelector as:aTargetAtomID
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11422
    "convert the current selection to the format defined by aTargetAtom.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11423
     Answer an association with the type of converted selection (an atomID)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11424
     and the converted selection"
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11425
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11426
    |buffer bufferAsString|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11427
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11428
    buffer := self perform:bufferGetSelector.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11429
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11430
    (aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11431
	"/ 'st-object' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11432
	"send the selection in binaryStore format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11433
	"require libboss to be loaded"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11434
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11435
	    Logger error:'cannot use binary store for copy buffer (libboss missing)'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11436
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11437
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11438
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11439
	[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11440
	    ^ aTargetAtomID -> (buffer binaryStoreBytes).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11441
	] on:Error do:[:ex|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11442
	    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
 11443
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11444
	].
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11445
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11446
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11447
    bufferAsString := self class bufferAsString:buffer.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11448
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11449
    (aTargetAtomID == (self atomIDOf:#STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11450
     or:[aTargetAtomID == (self atomIDOf:#'text/plain')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11451
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11452
	"/ 'string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11453
	"the other view wants the selection as string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11454
	^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
6160
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
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11457
    (aTargetAtomID == (self atomIDOf:#UTF8_STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11458
     or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11459
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11460
	"/ 'utf string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11461
	"the other view wants the selection as utf8 string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11462
	^ aTargetAtomID -> (bufferAsString utf8Encoded).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11463
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11464
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11465
    aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11466
	"the other one wants to know the size of our selection.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11467
	 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
 11468
	 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
 11469
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11470
	^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11471
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11472
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11473
    "we do not support the requestet target type"
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11474
    ^ nil -> nil.
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11475
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11476
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11477
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11478
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11479
setClipboardObject:anObject owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11480
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11481
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11482
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11483
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11484
    clipboardSelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11485
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11486
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11487
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11488
setClipboardText:aString owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11489
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11490
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11491
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11492
     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
 11493
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11494
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11495
    clipboardSelectionTime := primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11496
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11497
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11498
    self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11499
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11500
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11501
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11502
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11503
setPrimaryText:aString owner:aWindowId
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11504
    "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
 11505
     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
 11506
     pasting. X Window specific."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11507
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11508
    primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11509
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11510
    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
 11511
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11512
    "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
 11513
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11514
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11515
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11516
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11517
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11518
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 11519
    "Note: some sender code assumes that ST_OBJECT is first"
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11520
    ^ #(ST_OBJECT STRING UTF8_STRING TIMESTAMP TARGETS LENGTH
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11521
      #'text/plain' #'text/plain;codeset=utf-8'
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11522
    ) collect:[:eachTargetSymbol|
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11523
	    self atomIDOf:eachTargetSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11524
	] as:IntegerArray.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11525
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11526
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11527
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11528
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11529
getSelectionOwnerOf:selectionAtomSymbolOrID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11530
    "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
 11531
     Answer nil, if there is no owner"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11532
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11533
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11534
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11535
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11536
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11537
    selectionAtomSymbolOrID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11538
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11539
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11540
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11541
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11542
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11543
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11544
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11545
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11546
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11547
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11548
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11549
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11550
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11551
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11552
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11553
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11554
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11555
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11556
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11557
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11558
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11559
requestSelection:selectionID type:typeID for:aWindowId intoProperty:propertyID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11560
    "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
 11561
     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
 11562
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11563
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11564
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11565
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11566
    |anIntegerTimestamp|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11567
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11568
    anIntegerTimestamp := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11569
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11570
%{
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11571
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11572
    if (ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11573
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11574
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11575
     && __isAtomID(selectionID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11576
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11577
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11578
	Time time;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11579
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11580
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11581
	    w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11582
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11583
	    w = (Window)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11584
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11585
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11586
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11587
	if (anIntegerTimestamp == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11588
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11589
	     * 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
 11590
	     * the selection was requested and not to CurrentTime
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11591
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11592
	    time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11593
	} else if (__isInteger(anIntegerTimestamp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11594
	    time = __unsignedLongIntVal(anIntegerTimestamp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11595
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11596
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11597
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11598
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11599
	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11600
			       __AtomVal(propertyID), w, time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11601
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11602
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11603
	RETURN (true);
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11604
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11605
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11606
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11607
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11608
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11609
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11610
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11611
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11612
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11613
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11614
	type:(Display atomIDOf:'STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11615
	for:Transcript id
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 11616
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 11617
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11618
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11619
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11620
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11621
	type:(Display atomIDOf:'C_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11622
	for:Transcript id
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11623
    "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11624
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11625
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 11626
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
 11627
    "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
 11628
     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
 11629
     could not be converted.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11630
     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
 11631
     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
 11632
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11633
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11634
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11635
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11636
	&& (__isAtomID(propertyID) || propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11637
	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11638
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11639
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11640
	Window requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11641
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11642
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11643
	if (__isExternalAddress(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11644
	    requestor = __WindowVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11645
	} else if (__isSmallInteger(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11646
	    requestor = (Window)__smallIntegerVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11647
	} else if (requestorID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11648
	    requestor = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11649
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11650
	    requestor = (Window)__unsignedLongIntVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11651
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11652
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11653
	ev.xselection.type = SelectionNotify;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11654
	ev.xselection.display = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11655
	ev.xselection.selection = __AtomVal(selectionID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11656
	ev.xselection.target = __AtomVal(targetID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11657
	ev.xselection.requestor = requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11658
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11659
	if (__isExternalAddress(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11660
	    ev.xselection.time = (INT)(__externalAddressVal(aTime));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11661
	} else if (__isSmallInteger(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11662
	    ev.xselection.time = __smallIntegerVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11663
	} else if (aTime == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11664
	    ev.xselection.time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11665
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11666
	    ev.xselection.time = (INT)__unsignedLongIntVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11667
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 11668
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11669
	console_printf("ev.xselection.selection: %x\n", ev.xselection.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11670
	console_printf("ev.xselection.target: %x\n", ev.xselection.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11671
	console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11672
	console_printf("ev.xselection.time: %x\n", ev.xselection.time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11673
	console_printf("requestor: %x\n", requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11674
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11675
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11676
	/* send nil property if selection cannot be converted */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11677
	if (propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11678
	    ev.xselection.property = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11679
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11680
	    ev.xselection.property = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11681
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11682
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11683
	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
 11684
		(INT)ev.xselection.selection,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11685
		(INT)ev.xselection.property,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11686
		(INT)ev.xselection.target,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11687
		(INT)ev.xselection.requestor,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11688
		(INT)requestor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11689
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11690
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11691
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11692
	LEAVE_XLIB();
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 ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11695
	    DPRINTF(("bad status\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11696
	    RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11697
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11698
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11699
	XFlush(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11700
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11701
	RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11702
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11703
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11704
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 11705
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11706
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11707
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11708
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11709
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11710
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID time:anIntegerTimestamp
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11711
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11712
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11713
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11714
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11715
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11716
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11717
    "store the current owner of the selection.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11718
     If we still own the selection on paste,
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11719
     we can avoid the X11 overhead"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11720
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 11721
    selectionOwner := aWindowId.
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11722
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11723
    selectionAtomSymbolOrID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11724
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11725
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11726
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11727
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11728
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11729
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11730
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11731
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11732
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11733
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11734
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11735
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11736
	Time time;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11737
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11738
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11739
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11740
	if (anIntegerTimestamp == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11741
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11742
	     * 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
 11743
	     * the selection was acquired and not to CurrentTime
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11744
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11745
	    time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11746
	} else if (__isInteger(anIntegerTimestamp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11747
	    time = __unsignedLongIntVal(anIntegerTimestamp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11748
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11749
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11750
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11751
	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
 11752
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11753
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11754
	RETURN (self);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11755
	LEAVE_XLIB();
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11756
    }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11757
err:;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11758
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11759
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11760
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11761
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11762
!XWorkstation methodsFor:'window queries'!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11763
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11764
allChildIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11765
    "return all children-ids of the given window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11766
     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
 11767
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11768
    |childIDs allChildIDs|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11769
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11770
    allChildIDs := OrderedCollection new.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11771
    childIDs := self childIdsOf:aWindowId.
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
 11772
    childIDs notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11773
	allChildIDs addAll:childIDs.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11774
	childIDs do:[:eachChildId |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11775
	    allChildIDs addAll:(self allChildIdsOf:eachChildId).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11776
	].
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11777
    ].
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11778
    ^ allChildIDs
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11779
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11780
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11781
     Display allChildIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11782
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11783
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11784
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11785
     |deviceIDAtom uuidAtom|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11786
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11787
     deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11788
     uuidAtom     := (Display atomIDOf:#'UUID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11789
     (Display allChildIdsOf:(Display rootWindowId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11790
	select:[:id |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11791
	    |uuid|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11792
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11793
	    Display
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11794
		getProperty:deviceIDAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11795
		from:id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11796
		delete:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11797
		into:[:type :value |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11798
		    type == uuidAtom ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11799
			uuid := UUID fromBytes:value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11800
		    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11801
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11802
	    uuid notNil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11803
	]
4410
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
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11806
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11807
childIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11808
    "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
 11809
     enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11810
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11811
    |childIdArray|
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
    OBJ id;
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
    if (ISCONNECTED
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11816
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11817
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11818
	Window win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11819
	Window rootReturn, parentReturn;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11820
	Window* children = (Window *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11821
	unsigned int numChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11822
	int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11823
	int rslt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11824
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11825
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11826
	rslt = XQueryTree(dpy, win,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11827
		       &rootReturn, &parentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11828
		       &children, &numChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11829
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11830
	if (rslt) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11831
	    childIdArray = __ARRAY_NEW_INT(numChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11832
	    if (childIdArray != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11833
		for (i=0; i < numChildren; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11834
		    if (children[i]) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11835
			OBJ childId;
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
			childId = __MKEXTERNALADDRESS(children[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11838
			__ArrayInstPtr(childIdArray)->a_element[i] = childId;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11839
			__STORE(childIdArray, childId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11840
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11841
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11842
		if (children) XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11843
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11844
	    RETURN (childIdArray);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11845
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11846
    }
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
    ^ nil.
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
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11851
      Display childIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11852
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11853
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11854
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11855
realRootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11856
    "return the id of the real root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11857
     This may not be the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11858
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11859
     of it. Except for very special cases, use #rootWindowId, which takes
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11860
     care of any virtual root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11861
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11862
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11863
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11864
    Window root;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11865
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11866
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11867
    if (__INST(rootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11868
	RETURN (__INST(rootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11869
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11870
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11871
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11872
	root = RootWindow(myDpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11873
	if (! root) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11874
	    id = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11875
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11876
	    id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11877
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11878
	RETURN (id);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11879
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11880
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11881
    self primitiveFailedOrClosedConnection.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11882
    ^ nil
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11883
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11884
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11885
      Display rootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11886
      Display realRootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 11887
    "
4410
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
rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11891
    "return the id of the root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11892
     This is the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11893
     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
 11894
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11895
     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
 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 rootWin, vRootWin = 0;
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(virtualRootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11903
	RETURN (__INST(virtualRootId));
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
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11908
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11909
	rootWin = RootWindow(dpy, screen);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11910
#ifndef IRIS
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11911
6517
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
	 * on IRIS, this creates a badwindow error - why ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11914
	 * children contains a funny window (000034)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11915
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11916
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11917
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11918
	 * care for virtual root windows (tvtwm & friends)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11919
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11920
	{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11921
	    Atom vRootAtom, kwinAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11922
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11923
	    Window rootReturn, parentReturn;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11924
	    Window* children = (Window *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11925
	    unsigned int numChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11926
	    int ignoreVRoot = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11927
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11928
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11929
	     * Take care of KDE 2.1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11930
	     * they define _SWM_ROOT but this is not the parent of
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11931
	     * the application windows.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11932
	     * Instead it is used for background painting
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11933
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11934
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11935
	    kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11936
	    if (kwinAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11937
		Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11938
		int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11939
		unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11940
		unsigned char *retVal = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11941
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11942
		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11943
				       0L, 1L, False, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11944
				       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11945
				       &nitems, &bytesafter, &retVal) == Success
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11946
			      && actual_type != 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11947
		if (retVal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11948
		    XFree(retVal);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11949
	    }
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
	    if (!ignoreVRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11952
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11953
		if (vRootAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11954
		    if (XQueryTree(dpy, rootWin,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11955
				       &rootReturn, &parentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11956
				       &children, &numChildren)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11957
			for (i=0; i < numChildren; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11958
			    Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11959
			    int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11960
			    unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11961
			    Window* newRoot = (Window*) 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
			    if (children[i]) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11964
				if (XGetWindowProperty(dpy, children[i], vRootAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11965
						       0L, 1L, False, XA_WINDOW,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11966
						       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11967
						       &nitems, &bytesafter,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11968
						       (unsigned char**) &newRoot
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11969
						      ) == Success && newRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11970
				    vRootWin = *newRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11971
				    XFree(newRoot); /* XXX */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11972
				    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11973
				}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11974
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11975
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11976
			if (children) XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11977
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11978
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11979
	     }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11980
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11981
#endif
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11982
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11983
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11984
    if (! vRootWin) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11985
	vRootWin = rootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11986
	if (! vRootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11987
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11988
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11989
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11990
    id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11991
    id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11992
    RETURN ( id );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11993
%}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11994
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11995
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11996
      Display rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11997
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11998
! !
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11999
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12000
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12001
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12002
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12003
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12004
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12005
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12006
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12007
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12008
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12009
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12010
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12011
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12012
	 && __bothSmallInteger(x, y)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12013
	 && __bothSmallInteger(width, height)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12014
	    w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12015
	    h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12016
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12017
	     * 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
 12018
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12019
	    if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12020
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12021
		XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12022
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12023
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12024
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12025
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12026
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12027
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12028
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12029
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12030
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12031
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12032
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12033
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12034
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12035
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12036
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12037
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12038
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12039
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12040
	    XClearWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12041
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12042
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12043
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12044
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12045
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12046
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12047
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12048
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12049
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12050
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12051
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12052
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12053
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12054
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12055
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12056
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12057
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12058
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12059
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12060
	 && __isExternalAddress(siblingId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12061
	    if (modeSymbol == @symbol(above)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12062
		chg.stack_mode = Above;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12063
	    } else if (modeSymbol == @symbol(below)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12064
		chg.stack_mode = Below;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12065
	    } else if (modeSymbol == @symbol(topIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12066
		chg.stack_mode = TopIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12067
	    } else if (modeSymbol == @symbol(bottomIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12068
		chg.stack_mode = BottomIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12069
	    } else if (modeSymbol == @symbol(opposite)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12070
		chg.stack_mode = Opposite;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12071
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12072
		mask = CWSibling;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12073
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12074
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12075
	    chg.sibling = __WindowVal(siblingId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12076
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12077
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12078
				    mask, &chg);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12079
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12080
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12081
	}
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
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12084
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12085
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12086
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12087
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12088
getGeometryOf:aWindowId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12089
    "get a windows geometry.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12090
     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
 12091
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12092
     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
 12093
     relative to such a wrapper.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12094
     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
 12095
     (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
 12096
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12097
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12098
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12099
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12100
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12101
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12102
    int x_ret, y_ret;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12103
    unsigned int width_ret, height_ret,
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12104
		 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12105
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12106
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12107
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12108
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12109
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12110
	XGetGeometry(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12111
		     &root_ret,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12112
		     &x_ret, &y_ret,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12113
		     &width_ret, &height_ret, &border_width_ret,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12114
		     &depth_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12115
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12116
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12117
	x = __MKSMALLINT(x_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12118
	y = __MKSMALLINT(y_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12119
	width = __MKSMALLINT(width_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12120
	height = __MKSMALLINT(height_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12121
	depth = __MKSMALLINT(depth_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12122
	borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12123
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12124
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12125
    borderWidth isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12126
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12127
	^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12128
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12129
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12130
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12131
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12132
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12133
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12134
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12135
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12136
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12137
     Transcript topView device
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12138
	getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12139
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12140
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12141
     Transcript topView device
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12142
	getGeometryOf:(Transcript topView id)
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12143
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12144
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12145
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12146
	getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12147
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12148
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12149
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12150
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12151
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12152
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12153
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12154
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12155
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12156
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12157
    "return true, if the given window ID is (still) valid.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12158
     Especially useful, if the passed windowID is
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12159
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12160
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12161
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12162
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12163
%{
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12164
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12165
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12166
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12167
	char *name = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12168
	Status ok;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12169
	Window root, parent, *children = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12170
	unsigned int nChildren;
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12171
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12172
/*        ENTER_XLIB(); */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12173
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12174
			&root, &parent, &children, &nChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12175
	if (children) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12176
	    XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12177
	}
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12178
/*        LEAVE_XLIB();   */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12179
	if (ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12180
	    RETURN (true);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12181
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12182
	RETURN (false);
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12183
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12184
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12185
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12186
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12187
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12188
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12189
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12190
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12191
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12192
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12193
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12194
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12195
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12196
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12197
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12198
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12199
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12200
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12201
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12202
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12203
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12204
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12205
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12206
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12207
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12208
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12209
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12210
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12211
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12212
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12213
	XLowerWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12214
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12215
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12216
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12217
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12218
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12219
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12220
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12221
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12222
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12223
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12224
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12225
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12226
    "make a window visible - either as icon or as a real view
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12227
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12228
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12229
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12230
4480
3e1449309dfa Set icon mask in #mapWindow:....
Stefan Vogel <sv@exept.de>
parents: 4478
diff changeset
 12231
    |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12232
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12233
    aBoolean ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12234
	wicon := aView icon.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12235
	wicon notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12236
	    wiconId := wicon id.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12237
	    wicon mask notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12238
		iconMaskId := wicon mask id.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12239
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12240
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12241
	wiconView := aView iconView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12242
	wiconView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12243
	    wiconViewId := wiconView id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12244
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12245
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12246
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12247
    minExt notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12248
	minW := minExt x.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12249
	minH := minExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12250
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12251
    maxExt notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12252
	maxW := maxExt x.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12253
	maxH := maxExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12254
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12255
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12256
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12257
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12258
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12259
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12260
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12261
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12262
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12263
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12264
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12265
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12266
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12267
	szhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12268
	if (__bothSmallInteger(xPos, yPos)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12269
	    szhints.x = __intVal(xPos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12270
	    szhints.y = __intVal(yPos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12271
	    szhints.flags |= USPosition;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12272
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12273
	if (__bothSmallInteger(w, h)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12274
	    szhints.width = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12275
	    szhints.height = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12276
	    szhints.flags |= USSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12277
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12278
	if (__bothSmallInteger(minW, minH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12279
	    szhints.flags |= PMinSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12280
	    szhints.min_width = __intVal(minW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12281
	    szhints.min_height = __intVal(minH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12282
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12283
	if (__bothSmallInteger(maxW, maxH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12284
	    szhints.flags |= PMaxSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12285
	    szhints.max_width = __intVal(maxW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12286
	    szhints.max_height = __intVal(maxH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12287
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12288
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12289
	if (aBoolean == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12290
	    char *windowName = "";
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12291
	    Pixmap iconBitmap = (Pixmap)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12292
	    Pixmap iconMask = (Pixmap)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12293
	    Window iconWindow = (Window)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12294
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12295
	    if (__isExternalAddress(wiconId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12296
		iconBitmap = __PixmapVal(wiconId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12297
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12298
	    if (__isExternalAddress(iconMaskId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12299
		iconMask = __PixmapVal(iconMaskId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12300
	    }
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
	    if (__isExternalAddress(wiconViewId))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12303
		iconWindow = __WindowVal(wiconViewId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12304
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12305
	    if (__isStringLike(wlabel))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12306
		windowName = (char *) __stringVal(wlabel);
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 (iconBitmap || windowName) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12309
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12310
		XSetStandardProperties(dpy, win,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12311
					windowName, windowName,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12312
					iconBitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12313
					0, 0, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12314
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12315
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12316
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12317
	    wmhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12318
	    if (iconBitmap) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12319
		wmhints.flags |= IconPixmapHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12320
		wmhints.icon_pixmap = iconBitmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12321
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12322
	    if (iconMask) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12323
		wmhints.flags |= IconMaskHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12324
		wmhints.icon_mask = iconMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12325
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12326
	    if (iconWindow) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12327
		wmhints.flags |= IconWindowHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12328
		wmhints.icon_window = iconWindow;
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12331
	    wmhints.initial_state = IconicState;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12332
	    wmhints.flags |= StateHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12333
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12334
	    XSetWMHints(dpy, win, &wmhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12335
	    LEAVE_XLIB();
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12338
	if (szhints.flags) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12339
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12340
	    XSetNormalHints(dpy, win, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12341
	    LEAVE_XLIB();
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
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
	XMapWindow(dpy, win);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12346
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12347
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12348
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12349
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12350
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12351
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12352
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12353
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12354
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12355
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12356
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12357
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12358
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12359
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12360
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12361
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12362
	XMapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12363
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12364
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12365
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12366
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12367
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12368
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12369
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12370
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12371
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12372
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12373
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12374
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12375
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12376
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12377
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12378
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12379
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12380
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12381
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12382
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12383
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12384
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12385
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12386
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12387
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12388
			      __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12389
			      newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12390
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12391
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12392
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12393
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12394
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12395
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12396
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12397
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12398
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12399
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12400
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12401
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12402
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12403
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12404
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12405
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12406
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12407
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12408
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12409
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12410
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12411
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12412
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12413
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12414
newGraphicsContextFor:aGraphicsMedium
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12415
    "Redefined to use my own device specific graphics context"
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12416
7486
c3a1433996ec #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7478
diff changeset
 12417
    ^ X11GraphicsContext onDevice:self.
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12418
!
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12419
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12420
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12421
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12422
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12423
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12424
%{
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12425
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12426
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12427
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12428
	Status ok;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12429
	Window root, parent, *children = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12430
	unsigned int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12431
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12432
/*        ENTER_XLIB(); */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12433
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12434
			&root, &parent, &children, &nChildren);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12435
	if (children) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12436
	    XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12437
	}
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12438
/*        LEAVE_XLIB();   */
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12439
	if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12440
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12441
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12442
	RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12443
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12444
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12445
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12446
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12447
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12448
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12449
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12450
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12451
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12452
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12453
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12454
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12455
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12456
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12457
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12458
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12459
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12460
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12461
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12462
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12463
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12464
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12465
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12466
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12467
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12468
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12469
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12470
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12471
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12472
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12473
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12474
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12475
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12476
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12477
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12478
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12479
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12480
     && __isExternalAddress(newParentWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12481
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12482
	Window _child, _newParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12483
	int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12484
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12485
	_child = __WindowVal(windowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12486
	_newParent = __WindowVal(newParentWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12487
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12488
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12489
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12490
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12491
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12492
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12493
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12494
	 * Code 'stolen' from xswallow source ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12495
	 * ... mhmh - what is this loop for ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12496
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12497
	for (i=0; i<5; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12498
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12499
	    XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12500
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12501
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12502
	XMapWindow (dpy, _child);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12503
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12504
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12505
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12506
	RETURN ( true );
2426
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
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12509
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12510
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12511
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12512
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12513
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12514
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12515
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12516
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12517
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12518
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12519
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12520
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12521
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12522
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12523
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12524
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12525
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12526
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12527
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12528
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12529
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12530
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12531
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12532
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12533
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12534
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12535
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12536
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12537
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12538
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12539
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12540
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12541
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12542
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12543
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12544
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12545
	if (__INST(ignoreBackingStore) != true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12546
	    if (how == @symbol(always)) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12547
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12548
	    else if (how == true) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12549
	    else wa.backing_store = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12550
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12551
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12552
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12553
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12554
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12555
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12556
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12557
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12558
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12559
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12560
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12561
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12562
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12563
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12564
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12565
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12566
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12567
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12568
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12569
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12570
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12571
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12572
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12573
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12574
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12575
	    wa.bit_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12576
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12577
	    wa.bit_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12578
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12579
	    wa.bit_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12580
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12581
	    wa.bit_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12582
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12583
	    wa.bit_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12584
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12585
	    wa.bit_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12586
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12587
	    wa.bit_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12588
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12589
	    wa.bit_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12590
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12591
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12592
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12593
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12594
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12595
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12596
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12597
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12598
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12599
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12600
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12601
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12602
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12603
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12604
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12605
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12606
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12607
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12608
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12609
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12610
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12611
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12612
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12613
     && __isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12614
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12615
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12616
	Cursor c = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12617
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12618
	if (w && c) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12619
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12620
	    XDefineCursor(dpy, w, c);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12621
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12622
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12623
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12624
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12625
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12626
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12627
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12628
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12629
setForegroundWindow:aWindowId
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12630
    "bring a window to front.
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12631
     Send a specific message to the WindowManager"
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12632
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12633
    |activeWindowAtom|
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12634
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12635
"/    self raiseWindow:aWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12636
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12637
    activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12638
    activeWindowAtom notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12639
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12640
	    sendClientEvent:activeWindowAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12641
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12642
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12643
	    propagate:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12644
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12645
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12646
	    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
 12647
	    data2:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12648
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12649
	    data4:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12650
	    data5:nil.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12651
    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12652
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12653
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12654
      Transcript topView setForegroundWindow
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12655
    "
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12656
!
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12657
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12658
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12659
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12660
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12661
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12662
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12663
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12664
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12665
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12666
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12667
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 12668
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12669
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12670
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12671
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12672
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12673
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12674
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12675
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12676
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12677
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12678
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12679
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12680
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12681
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12682
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12683
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12684
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12685
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12686
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12687
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12688
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12689
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12690
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12691
	XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12692
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12693
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12694
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12695
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12696
    self primitiveFailedOrClosedConnection
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12697
!
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12698
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12699
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12700
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12701
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12702
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12703
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12704
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12705
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12706
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12707
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12708
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12709
	if (__INST(hasSaveUnder) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12710
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12711
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12712
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12713
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12714
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12715
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12716
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12717
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12718
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12719
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12720
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12721
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12722
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12723
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12724
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12725
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12726
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12727
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12728
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12729
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12730
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12731
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12732
	    w = (Window) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12733
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12734
	    if (__isExternalAddress(aMainWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12735
		w = __WindowVal(aMainWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12736
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12737
		goto getOutOfHere;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12738
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12739
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12740
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12741
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12742
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12743
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12744
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 12745
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12746
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12747
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12748
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12749
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12750
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12751
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12752
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12753
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12754
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12755
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12756
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12757
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12758
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12759
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12760
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12761
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12762
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12763
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12764
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12765
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12766
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12767
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12768
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12769
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12770
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12771
    "set the windows background pattern to be a form.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12772
     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
 12773
     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
 12774
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12775
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12776
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
 12777
%{  /* STACK: 64000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12778
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12779
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12780
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12781
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12782
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12783
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12784
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12785
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12786
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12787
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12788
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12789
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12790
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12791
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12792
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12793
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12794
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12795
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12796
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12797
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12798
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12799
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12800
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12801
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12802
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12803
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12804
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12805
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12806
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12807
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12808
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12809
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12810
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12811
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12812
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12813
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12814
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12815
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12816
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12817
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12818
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12819
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12820
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12821
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12822
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12823
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12824
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12825
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12826
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12827
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12828
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12829
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12830
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12831
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12832
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12833
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12834
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12835
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12836
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12837
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12838
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12839
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12840
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12841
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12842
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12843
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12844
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 12845
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12846
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12847
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12848
			  0, 0, shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12849
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12850
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12851
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12852
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12853
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12854
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12855
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12856
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12857
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12858
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12859
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12860
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12861
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12862
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12863
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12864
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12865
     && __isSmallInteger(aNumber)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12866
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12867
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12868
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12869
	RETURN ( self );
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
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12872
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12873
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12874
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12875
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
 12876
    "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
 12877
     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
 12878
     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
 12879
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12880
    <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
 12881
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12882
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12883
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12884
	XClassHint classhint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12885
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12886
	classhint.res_class = classhint.res_name = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12887
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12888
	if (__isStringLike(wClass)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12889
	    classhint.res_class = (char *) __stringVal(wClass);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12890
	} else if (wClass != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12891
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12892
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12893
	if (__isStringLike(wName)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12894
	    classhint.res_name = (char *) __stringVal(wName);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12895
	} else if (wName != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12896
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12897
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12898
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12899
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12900
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12901
	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
 12902
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 12903
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 12904
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12905
    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
 12906
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 12907
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12908
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12909
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12910
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12911
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12912
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12913
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12914
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12915
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12916
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12917
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12918
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12919
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12920
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12921
	    wa.win_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12922
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12923
	    wa.win_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12924
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12925
	    wa.win_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12926
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12927
	    wa.win_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12928
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12929
	    wa.win_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12930
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12931
	    wa.win_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12932
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12933
	    wa.win_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12934
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12935
	    wa.win_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12936
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12937
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12938
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12939
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12940
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12941
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12942
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12943
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12944
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12945
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12946
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12947
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12948
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12949
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12950
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12951
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12952
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12953
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12954
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12955
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12956
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12957
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12958
    aForm notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12959
	iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12960
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12961
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12962
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12963
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12964
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12965
	XWMHints hints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12966
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12967
	hints.icon_pixmap = __PixmapVal(iconId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12968
	hints.flags = IconPixmapHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12969
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12970
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12971
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12972
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12973
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12974
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12975
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12976
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12977
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 12978
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12979
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12980
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12981
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12982
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12983
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12984
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12985
    aForm notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12986
	iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12987
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12988
    aMaskForm notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12989
	maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12990
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12991
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12992
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12993
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 12994
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12995
	XWMHints hints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12996
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12997
	hints.icon_pixmap = __PixmapVal(iconId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12998
	hints.flags = IconPixmapHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12999
	if ((maskId != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13000
	 && __isExternalAddress(maskId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13001
	    hints.icon_mask = __PixmapVal(maskId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13002
	    hints.flags |= IconMaskHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13003
	}
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 );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13008
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13009
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13010
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13011
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13012
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13013
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13014
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13015
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13016
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13017
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13018
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13019
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13020
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13021
    aView notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13022
	iconWindowId := aView id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13023
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13024
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13025
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13026
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13027
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13028
	XWMHints wmhints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13029
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13030
	wmhints.icon_window = __WindowVal(iconWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13031
	wmhints.flags = IconWindowHint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13032
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13033
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13034
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13035
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13036
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13037
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13038
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13039
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13040
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 13041
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
 13042
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13043
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13044
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13045
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13046
%{
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13047
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13048
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13049
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13050
	XSizeHints szhints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13051
	Window win;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13052
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13053
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13054
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13055
	szhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13056
	if (__bothSmallInteger(minW, minH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13057
	    szhints.flags |= PMinSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13058
	    szhints.min_width = __intVal(minW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13059
	    szhints.min_height = __intVal(minH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13060
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13061
	if (__bothSmallInteger(maxW, maxH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13062
	    szhints.flags |= PMaxSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13063
	    szhints.max_width = __intVal(maxW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13064
	    szhints.max_height = __intVal(maxH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13065
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13066
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13067
	if (szhints.flags) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13068
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13069
	    XSetNormalHints(dpy, win, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13070
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13071
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13072
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13073
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13074
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13075
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13076
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13077
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13078
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13079
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13080
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13081
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13082
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13083
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13084
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13085
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 13086
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13087
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13088
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 13089
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13090
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13091
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13092
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13093
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13094
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13095
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13096
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13097
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13098
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13099
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13100
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13101
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13102
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13103
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13104
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13105
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13106
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13107
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13108
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13109
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13110
	XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13111
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13112
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13113
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13114
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13115
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13116
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13117
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
 13118
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
 13119
    "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
 13120
     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
 13121
     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
 13122
     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
 13123
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
 13124
    | 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
 13125
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
 13126
    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
 13127
    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
 13128
    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
 13129
    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
 13130
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
 13131
    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
 13132
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
 13133
    "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
 13134
!
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
 13135
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13136
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13137
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13138
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13139
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13140
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13141
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13142
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13143
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13144
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13145
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13146
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13147
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13148
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13149
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13150
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13151
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13152
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13153
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13154
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13155
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13156
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13157
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13158
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13159
			  0, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13160
			  shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13161
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13162
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13163
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13164
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13165
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13166
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13167
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13168
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13169
setWindowState:aSymbol in:aWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13170
    "tell the window type to the window manager.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13171
     Send a specific message to the WindowManager"
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13172
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13173
    |netWmWindowStateAtom stateAtom|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13174
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13175
    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
 13176
    stateAtom := self atomIDOf:aSymbol create:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13177
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13178
    (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13179
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13180
	    sendClientEvent:netWmWindowStateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13181
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13182
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13183
	    propagate:true
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13184
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13185
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13186
	    data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13187
	    data2:stateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13188
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13189
	    data4:1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13190
	    data5:nil.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13191
    ] ifFalse:[self halt.].
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13192
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13193
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13194
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13195
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13196
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13197
      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
 13198
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13199
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13200
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13201
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13202
setWindowType:aSymbol in:aWindowId
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13203
    "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
 13204
     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
 13205
     chapter 'Application Window Properties'
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13206
     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
 13207
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13208
    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
 13209
    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
 13210
    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
 13211
    EWMH compatible, as this improve UX on modern Linxu
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13212
    machines.
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13213
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13214
    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
 13215
    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
 13216
    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
 13217
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13218
    "
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13219
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13220
    | nameAtom typeAtom valueAtom |
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13221
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13222
    self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13223
		  _NET_WM_WINDOW_TYPE_DOCK
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13224
		  _NET_WM_WINDOW_TYPE_TOOLBAR
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13225
		  _NET_WM_WINDOW_TYPE_MENU
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13226
		  _NET_WM_WINDOW_TYPE_UTILITY
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13227
		  _NET_WM_WINDOW_TYPE_SPLASH
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13228
		  _NET_WM_WINDOW_TYPE_DIALOG
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13229
		  _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
 13230
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13231
    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
 13232
    nameAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13233
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13234
	self breakPoint: #jv.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13235
	^self
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13236
    ].
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13237
    "/ 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
 13238
    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
 13239
    typeAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13240
	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
 13241
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13242
    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
 13243
    valueAtom isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13244
	"/Hmm, no such property, not running under EWMH compliant WM?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13245
	self breakPoint: #jv.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13246
	^self
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13247
    ].
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13248
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13249
    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
 13250
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13251
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13252
"/   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
 13253
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13254
"/    |netWmWindowTypeAtom typeAtom|
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13255
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13256
"/    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
 13257
"/    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
 13258
"/
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13259
"/    (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
 13260
"/        self
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13261
"/            sendClientEvent:netWmWindowTypeAtom
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13262
"/            format:32
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13263
"/            to:(self rootWindowId)
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13264
"/            propagate:true
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13265
"/            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
 13266
"/            window:aWindowId
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13267
"/            data1:typeAtom
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13268
"/            data2:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13269
"/            data3:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13270
"/            data4:nil
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13271
"/            data5:nil.
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13272
"/    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13273
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13274
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13275
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13276
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13277
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13278
      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
 13279
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13280
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13281
      |v|
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13282
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13283
      v := TopView new create.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13284
      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
 13285
      v open.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13286
    "
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13287
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13288
    "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
 13289
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13290
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13291
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13292
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13293
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13294
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13295
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13296
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13297
     * 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
 13298
     */
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13299
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13300
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13301
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13302
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13303
    if (__isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13304
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13305
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13306
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13307
	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
 13308
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13309
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13310
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13311
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13312
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13313
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13314
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13315
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13316
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13317
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13318
%{
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13319
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13320
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13321
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13322
	Atom JunkAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13323
	int JunkInt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13324
	unsigned long WinState,JunkLong;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13325
	unsigned char *Property;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13326
	Atom WM_STATE_Atom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13327
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13328
	if (__INST(wmStateAtom) != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13329
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13330
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13331
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13332
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13333
			       WM_STATE_Atom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13334
			       0L, 2L, False, AnyPropertyType,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13335
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13336
			       &Property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13337
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13338
	    WinState=(unsigned long)(*((long*)Property));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13339
	    if (WinState==3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13340
		RETURN (true);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13341
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13342
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13343
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13344
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13345
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13346
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13347
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13348
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13349
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13350
!XWorkstation::PseudoDeviceWithoutXFTSupport class methodsFor:'documentation'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13351
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13352
documentation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13353
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13354
    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
 13355
    possibly overriding some messages.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13356
    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
 13357
    interface, which cannot draw strings into pixmaps using XFT fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13358
    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
 13359
    so it will draw using non-xft fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13360
    This should vanish, once the xft drawing works.
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13361
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13362
    [author:]
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13363
	cg
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13364
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13365
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13366
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13367
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'accessing'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13368
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13369
realDevice:aDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13370
    realDevice := aDevice.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13371
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13372
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13373
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'message forwarding'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13374
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13375
doesNotUnderstand:aMessage
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13376
    ^ aMessage sendTo:realDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13377
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13378
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13379
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'queries'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13380
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13381
deviceFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13382
    ^ realDevice deviceFonts keys reject:[:f | f isXftFont ]
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13383
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13384
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13385
supportsXftFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13386
    ^ false.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13387
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13388
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13389
!XWorkstation::SelectionFetcher class methodsFor:'documentation'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13390
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13391
documentation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13392
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13393
    This class is responsible for fetching the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13394
    The X11 clipboard is implemented via asynchonous messages.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13395
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13396
    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
 13397
    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
 13398
    process that requests the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13399
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13400
    [author:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13401
	Stefan Vogel (stefan@zwerg)
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13402
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13403
    [instance variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13404
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13405
    [class variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13406
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13407
    [see also:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13408
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13409
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13410
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13411
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13412
!XWorkstation::SelectionFetcher class methodsFor:'selections'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13413
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13414
requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13415
    ^ 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
 13416
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13417
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13418
!XWorkstation::SelectionFetcher methodsFor:'accessing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13419
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13420
drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13421
    ^ drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13422
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13423
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13424
getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13425
    "convert the data in buffer to a selection"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13426
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13427
    |selection|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13428
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13429
    buffer isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13430
	^ nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13431
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13432
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13433
    targetID == (display atomIDOf:#STRING) ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13434
	display clipboardEncoding notNil ifTrue:[
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13435
	    selection := buffer decodeFrom:display clipboardEncoding
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13436
	].
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13437
	selection := buffer.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13438
    ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13439
"/ Transcript show:'UTF8: '; showCR:buffer storeString.
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13440
	selection := buffer utf8Decoded.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13441
    ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13442
"/ Transcript show:'TEXT: '; showCR:buffer storeString.
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13443
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13444
    ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13445
"/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13446
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13447
    ]]]].
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
    selection notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13450
	(selection endsWith:Character cr) ifTrue:[
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13451
	    selection := selection asStringCollection copyWith:''
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13452
	].
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13453
	^ selection.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13454
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13455
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13456
    targetID == (display atomIDOf:#'TARGETS') ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13457
	^ buffer
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13458
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13459
    targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13460
	"require libboss to be loaded"
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13461
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13462
	    'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR.
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13463
	    ^ nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13464
	].
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13465
	^ (Object
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13466
	    readBinaryFrom:(ReadStream on:buffer)
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13467
	    onError:[:ex |
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13468
		('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR.
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13469
		nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
 13470
	    ])
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13471
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13472
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13473
    '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
 13474
    ' buffer:' infoPrint. buffer infoPrintCR.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13475
    ^ nil
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13476
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13477
    "Modified: / 23-08-2006 / 15:56:04 / cg"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13478
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13479
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13480
!XWorkstation::SelectionFetcher methodsFor:'event handling'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13481
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13482
message:aMessage
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13483
    "got an asynchronous event from the display.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13484
     Save and wake up waiters"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13485
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13486
    aMessage selector == #propertyChange:property:state:time: ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13487
	(aMessage arguments at:2) ~~ propertyID ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13488
	    "I am only interested in changes of the property used to
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13489
	     store the selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13490
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13491
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13492
	message notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13493
	    "this should not happen - bad selection holder?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13494
	    'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13495
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13496
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13497
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13498
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13499
    "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
 13500
     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
 13501
     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
 13502
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13503
    message := aMessage.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13504
    sema signal.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13505
!
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
propertyChange:aView property:aPropertyId state:stateSymbol time:time
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13508
    "this is a forwarded propretyChange event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13509
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13510
    |property propertyValue|
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13511
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13512
    incremental ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13513
	"ignore property changes until we are in incremental mode"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13514
	^ self.
4252
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
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13517
    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
 13518
    propertyValue := property value.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13519
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13520
    propertyValue size == 0 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13521
	"property with size 0 signals end of transfer"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13522
	done := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13523
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13524
	buffer isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13525
	    targetID := property key.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13526
	    buffer := propertyValue.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13527
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13528
	    targetID ~= property key ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13529
		'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13530
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13531
	    buffer := buffer, propertyValue.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13532
	].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13533
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13534
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13535
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13536
selectionClear:aView selection:selectionId time:time
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13537
    "sent when another X-client has created a selection.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13538
     This is a very X-specific mechanism."
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13539
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13540
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13541
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
 13542
    "this is a forwarded selectionNotify event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13543
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13544
    |property propertyKey atomName|
4252
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
    aSelectionID ~~ selectionID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13547
	"ignore notification that is not for our selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13548
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13549
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13550
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13551
    aPropertyID == 0 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13552
	"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
 13553
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13554
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13555
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13556
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13557
    property := display getProperty:aPropertyID from:drawableID delete:true.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13558
    property isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13559
	"the property does not exist in the specified window"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13560
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13561
	^ self
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13562
    ].
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13563
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13564
    propertyKey := property key.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13565
    propertyKey == aTargetID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13566
	"good, the property is consistent with our request.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13567
	 The whole selection is in the property"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13568
	buffer := property value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13569
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13570
    ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13571
	"this is an incremental transfer. Wait for property change"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13572
	incremental := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13573
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13574
	atomName := (display atomName:propertyKey) ? propertyKey.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13575
	'XWorkstation(error): unexpected targetID (' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13576
	atomName errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13577
	') in selectionNotify: ' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13578
	display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13579
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13580
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13581
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13582
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13583
!XWorkstation::SelectionFetcher methodsFor:'selection actions'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13584
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13585
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
 13586
    "request the selection of type targetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13587
     Wait for next asynchronous message and process it,
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13588
     until done"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13589
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13590
    display := aDisplay.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13591
    drawableID := aDrawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13592
    selectionID := aSelectionId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13593
    propertyID := display atomIDOf:#'VT_SELECTION'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13594
    targetID := aTargetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13595
    sema := Semaphore new name:'X11SelectionFetcher'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13596
    done := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13597
    incremental := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13598
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13599
    [
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13600
	|timeout|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13601
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13602
	display registerSelectionFetcher:self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13603
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13604
	display
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13605
	    requestSelection:aSelectionId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13606
	    type:aTargetId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13607
	    for:drawableID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13608
	    intoProperty:propertyID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13609
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13610
	timeout := display xlibTimeout.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13611
	[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13612
	    |currentMessage|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13613
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13614
	    (sema waitWithTimeout:timeout) isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13615
		"the selection owner didn't respond within reasonable time"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13616
		'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13617
		^ nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13618
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13619
	    currentMessage := message.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13620
	    message := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13621
	    currentMessage notNil ifTrue:[currentMessage sendTo:self].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13622
	] doUntil:[done].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13623
    ] ensure:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13624
	display unregisterSelectionFetcher:self.
4252
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
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13627
    ^ self getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13628
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13629
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13630
!XWorkstation::SelectionFetcher methodsFor:'testing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13631
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13632
matchesDrawableId:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13633
    "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
 13634
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13635
    ^ drawableID = aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13636
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13637
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13638
!XWorkstation::WindowGroupWindow class methodsFor:'documentation'!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13639
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13640
documentation
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13641
"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13642
    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
 13643
    is newer mapped. This window is used
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13644
    in XWMHints & _NET_WM_LEADER properties to define
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13645
    application window group
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13646
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13647
    [author:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13648
	Jan Vrany <jan.vrany@fit.cvut.cz>
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13649
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13650
    [instance variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13651
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13652
    [class variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13653
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13654
    [see also:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13655
	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
 13656
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13657
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13658
"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13659
! !
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13660
6291
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13661
!XWorkstation::WindowGroupWindow methodsFor:'testing'!
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13662
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13663
isICCCWindowGroupWindow
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13664
    ^ true
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13665
! !
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13666
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13667
!XWorkstation::X11GraphicsContext methodsFor:'accessing'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13668
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13669
depth
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13670
    ^ depth
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13671
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13672
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13673
xftDrawId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13674
    ^ xftDrawId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13675
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13676
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13677
!XWorkstation::X11GraphicsContext methodsFor:'destroying'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13678
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13679
destroy
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13680
    xftDrawId notNil ifTrue:[
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13681
	self destroyXftDrawId.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13682
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13683
    super destroy.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13684
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13685
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13686
destroyXftDrawId
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13687
    |id|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13688
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13689
    id := xftDrawId.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13690
    xftDrawId := nil.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13691
%{
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13692
#ifdef XFT
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13693
    if (__isExternalAddress(id)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13694
	XftDraw *address = (XftDraw *)__externalAddressVal(id);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13695
	if (address) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13696
	    XftDrawDestroy(address);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13697
	    __externalAddressVal(id) = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13698
	}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13699
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13700
#endif
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13701
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13702
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13703
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13704
!XWorkstation::X11GraphicsContext methodsFor:'displaying'!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13705
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13706
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
 13707
    "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
 13708
     foreground and background characters.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13709
     If the coordinates are not integers, an error is triggered."
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13710
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13711
    <context: #return>
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13712
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13713
    |displayId|
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13714
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13715
    font isXftFont ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13716
	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
 13717
	^ self.
7416
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
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13720
    device flushIfAppropriate.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13721
    displayId := device displayIdOrErrorIfBroken.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13722
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13723
%{
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13724
    GC gc;
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13725
    Window win;
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13726
    char *cp;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13727
    int  i1, i2, l, n;
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13728
#   define NLOCALBUFFER 200
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13729
    XChar2b xlatebuffer[NLOCALBUFFER];
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13730
    int nInstBytes;
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13731
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13732
    if (__isExternalAddress(displayId)
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13733
     && __isExternalAddress(__INST(gcId))
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13734
     && __isExternalAddress(__INST(drawableId))
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13735
     && __isNonNilObject(aString)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13736
     && __bothSmallInteger(index1, index2)
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13737
     && __bothSmallInteger(x, y)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13738
	int lMax = __intVal(@global(XWorkstation:MaxStringLength));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13739
	Display *dpy = __DisplayVal(displayId);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13740
	gc = __GCVal(__INST(gcId));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13741
	win = __WindowVal(__INST(drawableId));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13742
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13743
	i1 = __intVal(index1) - 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13744
	if (i1 >= 0) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13745
	    OBJ cls;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13746
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13747
	    i2 = __intVal(index2) - 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13748
	    if (i2 < i1) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13749
		RETURN (self);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13750
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13751
	    cp = (char *) __stringVal(aString);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13752
	    l = i2 - i1 + 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13753
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13754
	    if (__isStringLike(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13755
		n = __stringSize(aString);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13756
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13757
		    cp += i1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13758
		    if (l > lMax) l = lMax;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13759
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13760
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13761
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13762
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13763
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13764
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13765
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13766
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13767
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13768
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13769
	    cls = __qClass(aString);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13770
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13771
	    cp += nInstBytes;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13772
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13773
	    if (__isBytes(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13774
		n = __byteArraySize(aString) - nInstBytes - 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13775
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13776
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13777
		    cp += i1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13778
		    if (l > lMax) l = lMax;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13779
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13780
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13781
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13782
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13783
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13784
		    LEAVE_XLIB();
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
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13788
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13789
	    /* TWOBYTESTRINGS */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13790
	    if (__isWords(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13791
		n = (__byteArraySize(aString) - nInstBytes) / 2;
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
		    union {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13794
			char b[2];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13795
			unsigned short s;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13796
		    } u;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13797
		    int i;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13798
		    XChar2b *cp2 = (XChar2b *)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13799
		    int mustFree = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13800
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13801
		    cp += (i1 * 2);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13802
		    if (l > lMax) l = lMax;
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13803
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13804
#if defined(MSBFIRST) || defined(__MSBFIRST)
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13805
		    /*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13806
		     * chars already in correct order
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13807
		     */
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13808
#else
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13809
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13810
		    /*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13811
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13812
		     * X expects them MSB first
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13813
		     * convert as required
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13814
		     */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13815
		    u.s = 0x1234;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13816
		    if (u.b[0] != 0x12)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13817
# endif  // ! (defined(LSBFIRST) || defined(__LSBFIRST))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13818
		    {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13819
			if (l <= NLOCALBUFFER) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13820
			    cp2 = xlatebuffer;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13821
			} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13822
			    cp2 = (XChar2b *)(malloc(l * 2));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13823
			    mustFree = 1;
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
			for (i=0; i<l; i++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13826
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13827
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13828
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13829
			cp = (char *) cp2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13830
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13831
#endif  // ! (defined(MSBFIRST) || defined(__MSBFIRST))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13832
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13833
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13834
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13835
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13836
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13837
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13838
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13839
		    if (mustFree) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13840
			free(cp2);
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
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13843
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13844
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13845
	    }
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
	    /* FOURBYTESTRINGS */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13848
	    if (__isLongs(aString)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13849
		n = (__byteArraySize(aString) - nInstBytes) / 4;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13850
		if (i2 < n) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13851
		    union {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13852
			char b[2];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13853
			unsigned short s;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13854
		    } u;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13855
		    int i;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13856
		    XChar2b *cp2 = (XChar2b *)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13857
		    int32 *ip;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13858
		    int mustFree = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13859
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13860
		    cp += (i1 * 4);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13861
		    if (l > lMax) l = lMax;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13862
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13863
		    /*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13864
		     * 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
 13865
		     */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13866
		    if (l <= NLOCALBUFFER) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13867
			cp2 = xlatebuffer;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13868
		    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13869
			cp2 = (XChar2b *)(malloc(l * 2));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13870
			mustFree = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13871
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13872
		    for (i=0; i<l; i++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13873
			int32 codePoint = ((int32 *)cp)[i];
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 (codePoint > 0xFFFF) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13876
			    codePoint = 0xFFFF;
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
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13879
			cp2[i].byte2 = codePoint & 0xFF;
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
		    __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13883
		    if (opaque == true)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13884
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13885
		    else
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13886
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13887
		    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13888
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13889
		    if (mustFree) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13890
			free(cp2);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13891
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13892
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13893
		    RETURN ( self );
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13894
		}
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
	}
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13897
    }
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 13898
#undef NLOCALBUFFER
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13899
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13900
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13901
    "x/y not integer, badGC or drawable, or not a string"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13902
    device primitiveFailedOrClosedConnection
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13903
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13904
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13905
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
 13906
    "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
 13907
     foreground and background characters.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13908
     If the coordinates are not integers, an error is triggered."
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13909
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13910
    <context: #return>
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13911
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13912
    |index2 bytesPerCharacter
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13913
     clipX clipY clipW clipH
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13914
     fgR fgG fgB fgA fgPixel bgR bgG bgB bgA bgPixel
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13915
     displayId screen error stringLen
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13916
     newXftDrawId pixmapDepth fontId|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13917
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13918
"/    device flushIfAppropriate.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13919
    displayId := device displayIdOrErrorIfBroken.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13920
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13921
    "limit the string len, otherwise bad output is generated"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13922
    stringLen := index2Arg - index1 + 1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13923
    stringLen > 1000 "8000" ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13924
	index2 := index1 + 1000 "8000" - 1.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13925
    ]  ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13926
	stringLen <= 0 ifTrue:[^ self].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13927
	index2 := index2Arg.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13928
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13929
    bytesPerCharacter := aString bytesPerCharacter.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13930
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13931
    clipRect notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13932
	clipX := clipRect left.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13933
	clipY := clipRect top.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13934
	clipW := clipRect width.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13935
	clipH := clipRect height.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13936
"/clipW > 32767 ifTrue:['clipW > 32767: ' errorPrint. clipW errorPrintCR. clipW := 32767].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13937
"/(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
 13938
	"/ YES YES YES: this MUST be transformed!!
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13939
	"/ (see htmlView) fix the notebook, please.
7416
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
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13942
    fgR := paint scaledRed.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13943
    fgR notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13944
	fgG := paint scaledGreen.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13945
	fgB := paint scaledBlue.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13946
	fgA := paint scaledAlpha.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13947
    ] ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13948
	"/ when drawing into a pixmap...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13949
	fgPixel := paint colorId.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13950
	fgPixel == 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13951
	    fgR := fgG := fgB := 0.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13952
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13953
	    fgR := fgG := fgB := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13954
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13955
	fgA := 16rFFFF.
7416
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
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13958
    opaque ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13959
	bgPaint isColor ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13960
	    bgR := bgPaint scaledRed.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13961
	    bgR notNil ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13962
		bgG := bgPaint scaledGreen.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13963
		bgB := bgPaint scaledBlue.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13964
		bgA := bgPaint scaledAlpha.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13965
	    ] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13966
		"/ when drawing into a pixmap...
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13967
		bgPixel := bgPaint colorId.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13968
		bgPixel == 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13969
		    bgR := bgG := bgB := 0.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13970
		] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13971
		    bgR := bgG := bgB := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13972
		].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13973
		bgA := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13974
	    ].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13975
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13976
	    "images as background are not yet implemented"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13977
	    "/ #todo: fill background rectangle
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13978
	    bgR := bgG := bgB := bgA := 16rFFFF.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13979
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13980
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13981
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13982
    screen := device screen.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13983
    self isPixmap ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 13984
	pixmapDepth := depth.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13985
    ].
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7416
diff changeset
 13986
    fontId := font getXftFontId.
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13987
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13988
%{ /* STACK: 64000 */
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13989
#ifdef XFT
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13990
    XftColor color;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13991
    XGlyphInfo extents;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13992
    XRectangle clipRX;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13993
    char *string;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13994
    int len;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13995
    int __bytesPerCharacter;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13996
    XftDraw *__xftDrawId;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13997
    XftFont *__xftFont;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13998
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 13999
    if (!(__bothSmallInteger(drawX, drawY)
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14000
	  && __bothSmallInteger(index1, index2)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14001
	  && __isSmallInteger(bytesPerCharacter)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14002
	  && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14003
	  && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14004
	  && __isNonNilObject(aString)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14005
	  && __isExternalAddress(displayId)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14006
	  && __isExternalAddressLike(fontId)
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14007
    )) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14008
	error = @symbol(badArgument);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14009
	goto out;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14010
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14011
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14012
    __xftFont = XFT_FONT(fontId);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14013
    __bytesPerCharacter = __intVal(bytesPerCharacter);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14014
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14015
    if (__INST(xftDrawId) != nil) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14016
	__xftDrawId = __externalAddressVal(__INST(xftDrawId));
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14017
    } else {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14018
	if (pixmapDepth != nil) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14019
	    int __pixmapDepth = __intVal(pixmapDepth);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14020
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14021
	    if (__pixmapDepth == 1) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14022
		__xftDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(__INST(drawableId)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14023
	    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14024
		__xftDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(__INST(drawableId)), __pixmapDepth);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14025
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14026
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14027
	    __xftDrawId = XftDrawCreate(DISPLAY(displayId),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14028
					   DRAWABLE(__INST(drawableId)),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14029
					   DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14030
					   DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14031
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14032
	__INST(xftDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__xftDrawId);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14033
	__STORE(self, newXftDrawId);
7416
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
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14036
    string = __stringVal(aString) + ((__intVal(index1) - 1 ) * __bytesPerCharacter);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14037
    len = __intVal(index2) - __intVal(index1) + 1;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14038
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14039
    if (clipX != nil) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14040
	clipRX.x = __intVal(clipX);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14041
	clipRX.y = __intVal(clipY);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14042
	clipRX.width = __intVal(clipW);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14043
	clipRX.height = __intVal(clipH);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14044
	XftDrawSetClipRectangles(__xftDrawId, 0, 0, &clipRX, 1);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14045
    } else {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14046
	XftDrawSetClip(__xftDrawId, 0);
7416
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
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14049
    if (opaque == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14050
	if (bgPixel != nil) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14051
	    color.pixel = (unsigned long)__intVal(bgPixel);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14052
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14053
	color.color.red = __intVal(bgR);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14054
	color.color.green = __intVal(bgG);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14055
	color.color.blue = __intVal(bgB);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14056
	color.color.alpha = __intVal(bgA);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14057
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14058
	switch (__bytesPerCharacter) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14059
	case 1:
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14060
	    XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14061
	    break;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14062
	case 2:
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14063
	    XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14064
	    break;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14065
	case 4:
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14066
	    XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14067
	    break;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14068
	}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14069
if (extents.width < 0) printf("width: %d  < 0\n", extents.width);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14070
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14071
	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
 14072
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14073
    if (__isSmallInteger(fgPixel)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14074
	color.pixel = (unsigned long)__intVal(fgPixel);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14075
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14076
    color.color.red = __intVal(fgR);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14077
    color.color.green = __intVal(fgG);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14078
    color.color.blue = __intVal(fgB);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14079
    color.color.alpha = __intVal(fgA);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14080
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14081
    switch (__bytesPerCharacter) {
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14082
    case 1:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14083
	XftDrawString8(__xftDrawId, &color,__xftFont,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14084
			__intVal(drawX),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14085
			__intVal(drawY),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14086
			(FcChar8*)string,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14087
			len);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14088
	break;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14089
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14090
    case 2:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14091
	XftDrawString16(__xftDrawId, &color, __xftFont,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14092
			__intVal(drawX),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14093
			__intVal(drawY),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14094
			(FcChar16*)string,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14095
			len);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14096
	break;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14097
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14098
    case 4:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14099
	XftDrawString32(__xftDrawId, &color, __xftFont,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14100
			__intVal(drawX),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14101
			__intVal(drawY),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14102
			(FcChar32*)string,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14103
			len);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14104
	break;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14105
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14106
    default:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14107
	error = @symbol(invalidStringSize);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14108
	goto out;
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14109
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14110
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14111
out:;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14112
#endif
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14113
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14114
    error notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14115
	self primitiveFailed: error.
7416
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
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14118
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14119
!XWorkstation::X11GraphicsContext methodsFor:'drawing'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14120
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14121
XXclearDeviceRectangleX:x y:y width:width height:height
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14122
    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
 14123
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14124
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14125
XXclearRectangleX:x y:y width:w height:h
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14126
    "draw a filled rectangle; apply transformation if nonNil"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14127
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14128
    |pX pY nW nH pO pC|
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14129
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14130
    gcId isNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14131
	self initGC
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14132
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14133
    transformation notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14134
	pO := transformation transformPoint:x@y.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14135
	pC := transformation transformPoint:(x+w-1)@(y+h-1).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14136
	pX := pO x.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14137
	pY := pO y.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14138
	nW := pC x - pX + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14139
	nH := pC y - pY + 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14140
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14141
	nW < 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14142
	      nW := nW abs.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14143
	      pX := pX - nW.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14144
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14145
	nH < 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14146
	      nH := nH abs.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14147
	      pY := pY - nH.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14148
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14149
    ] ifFalse:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14150
	pX := x.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14151
	pY := y.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14152
	nW := w.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14153
	nH := h.
7416
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
    pX := pX rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14156
    pY := pY rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14157
    nW := nW rounded.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14158
    nH := nH rounded.
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
    device
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14161
	clearRectangleX:pX
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14162
		     y:pY
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14163
		 width:nW
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14164
		height:nH
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 14165
		    in:drawableId with:gcId
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14166
! !
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14167
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14168
!XWorkstation::X11GraphicsContext methodsFor:'view creation'!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14169
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14170
createBitmapFromArray:data width:width height:height
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14171
    depth := 1.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14172
    super createBitmapFromArray:data width:width height:height
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14173
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14174
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14175
createPixmapWidth:w height:h depth:d
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14176
    depth := d.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
 14177
    super createPixmapWidth:w height:h depth:d
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 14178
! !
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 14179
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 14180
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14181
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14182
version
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 14183
    ^ '$Header$'
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14184
!
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14185
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 14186
version_CVS
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 14187
    ^ '$Header$'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14188
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 14189
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
 14190
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14191
XWorkstation initialize!