XWorkstation.st
author Claus Gittinger <cg@exept.de>
Tue, 16 Jul 2019 15:06:06 +0200
changeset 8732 2126b6c5f654
parent 8706 92fd4a337e50
child 8756 731ac340b5cf
permissions -rw-r--r--
#FEATURE by cg class: ModalBox added: #windowTitle #windowTitle:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
     1
"{ Encoding: utf8 }"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
     2
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     3
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     4
COPYRIGHT (c) 1989 by Claus Gittinger
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
     5
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
"
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    14
"{ 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
    15
6758
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
    16
"{ NameSpace: Smalltalk }"
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
    17
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    18
DeviceWorkstation subclass:#XWorkstation
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    19
	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    20
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    21
		hasImageExtension hasInputExtension hasXineramaExtension
8681
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    22
		hasRenderExtension hasXTestExtension hasXftLibrary
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    23
		ignoreBackingStore blackpixel whitepixel atoms protocolsAtom
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    24
		deleteWindowAtom saveYourselfAtom quitAppAtom primaryAtom
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    25
		clipboardAtom stringAtom wmStateAtom motifWMHintsAtom
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    26
		listOfXFonts buttonsPressed eventRootX eventRootY displayName
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    27
		eventTrace dispatchingExpose rgbVisual rgbaVisual virtualRootId
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    28
		rootId altModifierMask metaModifierMask lastEventTime
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
    29
		rawMonitorBounds monitorBounds lastButtonPressTime
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
    30
		lastButtonPressPosition deviceIOTimeoutErrorSignal
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    31
		activateOnClick rawKeySymTranslation clipboardSelectionTime
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    32
		primarySelectionTime selectionFetchers selectionHandlers
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    33
		preWaitAction xlibTimeout xlibTimeoutForWindowCreation
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    34
		hasConnectionBroken uniqueDeviceID stxDeviceAtom uuidAtom
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    35
		primaryBuffer windowGroupWindow maxOperationsUntilFlush
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    36
		operationsUntilFlush lastError'
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    37
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    38
		DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    39
		ErrorDBCache'
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    40
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    41
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    42
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    43
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    44
Object subclass:#PseudoDeviceWithoutXFTSupport
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    45
	instanceVariableNames:'realDevice'
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    46
	classVariableNames:''
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    47
	poolDictionaries:''
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    48
	privateIn:XWorkstation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    49
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    50
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    51
Object subclass:#SelectionFetcher
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    52
	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    53
		buffer done incremental'
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    54
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    55
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    56
	privateIn:XWorkstation
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    57
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    58
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    59
SimpleView subclass:#WindowGroupWindow
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    60
	instanceVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    61
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    62
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    63
	privateIn:XWorkstation
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    64
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    65
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    66
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    67
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    68
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    69
#define SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    70
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    71
#ifdef LINUX
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    72
# ifndef __arm__
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    73
#  define SHM
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    74
# endif
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    75
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    76
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    77
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    78
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    79
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    80
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    81
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    82
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    83
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    84
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    85
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    86
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    87
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    88
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    89
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    90
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    91
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    92
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    93
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    94
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    95
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    96
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    97
 * 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
    98
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    99
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   100
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   101
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   102
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   103
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   104
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   105
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   106
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   107
#include <stdio.h>
5989
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   108
6041
cd2da50a737c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   109
#if defined(__osx__)
5989
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   110
# include <malloc/malloc.h>
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   111
extern void *malloc();
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   112
#else
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   113
# ifndef FREEBSD
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   114
#  include <malloc.h>
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   115
# endif
5528
42447013fbc6 freebsd
Michael Beyl <mb@exept.de>
parents: 5525
diff changeset
   116
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   117
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   118
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   119
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   120
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   121
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   122
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   123
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   124
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   125
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   126
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   127
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   128
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   129
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   130
extern OBJ __GLOBAL_GET_BY_NAME(char *);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   131
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   132
# define __HANDLE_VAL(type, externalAddress) \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   133
	((type)__externalAddressVal(externalAddress))
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   134
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   135
# define __HANDLE_NEW(ptr, __cls)                    \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   136
	({                                           \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   137
	    OBJ handle = __MKEXTERNALADDRESS(ptr);   \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   138
	    OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   139
	    __InstPtr(handle)->o_class = clsObj;     \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   140
	    __STORE(handle, clsObj);                 \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   141
	    handle;                                  \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   142
	})
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
   143
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   144
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   145
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   146
 * 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
   147
 * 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
   148
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   149
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   150
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   151
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   152
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
   153
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
   154
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   155
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
   156
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   157
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   158
48194c26a46c Initial revision
claus
parents:
diff changeset
   159
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   160
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   161
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   162
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   163
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   164
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   165
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   166
48194c26a46c Initial revision
claus
parents:
diff changeset
   167
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   168
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   169
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   170
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   171
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   172
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   173
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   174
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   175
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   176
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   177
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   178
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   179
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   180
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   181
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   182
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   183
/*
186
claus
parents: 180
diff changeset
   184
 * PEX extension - if available
claus
parents: 180
diff changeset
   185
 */
claus
parents: 180
diff changeset
   186
#ifdef PEX5
claus
parents: 180
diff changeset
   187
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   188
#endif
claus
parents: 180
diff changeset
   189
claus
parents: 180
diff changeset
   190
/*
claus
parents: 180
diff changeset
   191
 * XImage extension - if available
claus
parents: 180
diff changeset
   192
 */
claus
parents: 180
diff changeset
   193
#ifdef XIE
claus
parents: 180
diff changeset
   194
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   195
#endif
claus
parents: 180
diff changeset
   196
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   197
/*
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   198
 * multiscreen extension - if available
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   199
 */
5865
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   200
#ifdef XINERAMA
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   201
# include <X11/extensions/Xinerama.h>
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   202
#endif
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   203
186
claus
parents: 180
diff changeset
   204
/*
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   205
 * XCURSOR extension - if available
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   206
 */
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   207
#ifdef XCURSOR
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   208
# include <X11/Xcursor/Xcursor.h>
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   209
#endif
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
/*
6159
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   212
 * xft library (based on RENDER extension) - if available
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   213
 */
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   214
#ifdef XFT
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   215
# 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
   216
# 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
   217
# include <X11/extensions/render.h>
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   218
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   219
# define XFT_FONT(x)            __HANDLE_VAL(XftFont*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   220
# define XFT_FONT_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftFontHandle")
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   221
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   222
# define XFT_DRAW(x)            __HANDLE_VAL(XftDraw*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   223
# define XFT_DRAW_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftDrawHandle")
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   224
#endif // XFT
6159
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   225
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   226
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   227
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   228
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   229
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   230
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   231
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   232
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   233
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   234
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   235
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   236
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   237
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   238
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   239
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   240
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
   241
#ifdef XTEST
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
   242
# include <X11/extensions/XTest.h>
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
   243
#endif
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
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 */
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1023
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1024
					   | Button4MotionMask | Button5MotionMask));
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1025
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1026
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1027
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1028
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1029
asPseudoDeviceWithoutXFTSupport
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1030
    "return a pseudo device to be used when drawing into pixmaps
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1031
     on a device where xft-drawing into pixmaps is broken.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1032
     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
  1033
     then, we should return self here."
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  1034
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1035
    ^ PseudoDeviceWithoutXFTSupport basicNew realDevice:self
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1036
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1037
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1038
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1039
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1040
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1041
    ^ blackpixel
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1044
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1045
    "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
  1046
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1047
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1048
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1049
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1050
%}
540
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
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1053
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1054
    "
295
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1057
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1058
    "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
  1059
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1060
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1061
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1062
    RETURN (__MKSMALLINT(Button2MotionMask));
295
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1066
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1067
    "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
  1068
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1069
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1070
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1071
    RETURN (__MKSMALLINT(Button3MotionMask));
295
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
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1075
buttonMotionMask:aButtonNr
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1076
    "return the state-mask for button<n> in motion events state-field.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1077
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1079
%{  /* NOCONTEXT */
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1080
    if (aButtonNr == __MKSMALLINT(1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1081
	RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1082
    }
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1083
    if (aButtonNr == __MKSMALLINT(2)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1084
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1085
    }
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1086
    if (aButtonNr == __MKSMALLINT(3)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1087
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1088
    }
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1089
    if (aButtonNr == __MKSMALLINT(4)) {
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1090
	RETURN (__MKSMALLINT(Button4MotionMask));
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1091
    }
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1092
    if (aButtonNr == __MKSMALLINT(5)) {
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1093
	RETURN (__MKSMALLINT(Button5MotionMask));
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1094
    }
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1095
    if (aButtonNr == @symbol(all)) {
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1096
	RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1097
					       | Button4MotionMask | Button5MotionMask));
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  1098
    }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1099
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1100
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1101
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1102
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1103
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1104
    "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
  1105
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1106
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1107
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1108
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1109
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1110
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1111
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1112
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
  1113
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1114
48194c26a46c Initial revision
claus
parents:
diff changeset
  1115
%{  /* NOCONTEXT */
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1116
#ifndef __win32__
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1117
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1118
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1119
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1120
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1121
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1122
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1123
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1124
133
claus
parents: 132
diff changeset
  1125
displayName
claus
parents: 132
diff changeset
  1126
    "return the X-connections display name.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1127
     This is (currently) nil for the default display,
133
claus
parents: 132
diff changeset
  1128
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
  1129
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
  1130
claus
parents: 132
diff changeset
  1131
    ^ displayName
claus
parents: 132
diff changeset
  1132
!
claus
parents: 132
diff changeset
  1133
4153
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1134
displayName: something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1135
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1136
    displayName := something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1137
!
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1138
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1139
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1140
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1141
     any interest"
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
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1144
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1145
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1146
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1147
    RETURN (nil);
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
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1150
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1151
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1152
    "
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
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1156
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1157
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1158
     (to avoid bugs in certain implementations)"
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
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1161
	RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1162
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1163
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1164
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1165
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1166
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1167
     Display serverVendor
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1168
     Display platformName
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1169
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1170
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1171
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1172
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1173
    "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
  1174
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1175
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1176
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1177
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1178
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1179
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1180
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1181
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1182
     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
  1183
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1184
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1185
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1186
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1187
    |x1 y1 x2 y2 rootWindowId|
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1188
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1189
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1190
    y1 := y2 := aPoint y truncated.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1191
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1192
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1193
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1194
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1195
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1196
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1197
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1198
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1199
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1200
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1201
     && __bothSmallInteger(x1, y1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1202
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1203
	Window rootWin;
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
	w1 = __WindowVal(windowId1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1206
	w2 = __WindowVal(windowId2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1207
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1208
	rootWin = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1209
	if (w1 == rootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1210
	    w1 = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1211
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1212
	if (w2 == rootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1213
	    w2 = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1214
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1215
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1216
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1217
	XTranslateCoordinates(dpy, w1, w2,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1218
			      __intVal(x1), __intVal(y1),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1219
			      &xpos, &ypos, &child_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1220
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1221
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1222
	x2 = __MKSMALLINT(xpos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1223
	y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1224
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1225
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1226
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1227
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1228
!
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
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1231
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1232
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1233
     (to avoid bugs in certain implementations)"
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
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1236
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1237
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1238
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1239
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1240
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1241
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1242
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1243
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1244
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1245
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1246
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1247
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1248
    "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
  1249
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1250
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1251
     - 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
  1252
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1253
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1254
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1255
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1256
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1257
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1258
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1259
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1260
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1261
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1262
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1263
     && __isPoint(aPoint)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1264
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1265
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1266
	xp = _point_X(aPoint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1267
	yp = _point_Y(aPoint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1268
	if (__bothSmallInteger(xp, yp)) {
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
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1271
	    XTranslateCoordinates(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1272
				  RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1273
				  __WindowVal(windowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1274
				  __intVal(xp), __intVal(yp),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1275
				  &xpos, &ypos, &child_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1276
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1277
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1278
	    if (child_ret) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1279
		RETURN ( __MKEXTERNALADDRESS(child_ret) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1280
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1281
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1282
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1283
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1284
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1285
    windowId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1286
	aPoint isPoint ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1287
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1288
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1289
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1290
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1291
    ^ nil
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1292
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1293
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1294
      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
  1295
    "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1296
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1297
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1298
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1299
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1300
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1301
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1302
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1303
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1304
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1305
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1306
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1307
    if (ISCONNECTED
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1308
     && (__INST(rootId) != __INST(virtualRootId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1309
     && __isExternalAddress(__INST(virtualRootId))) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1310
	Window vRootWin;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1311
	Window root;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1312
	int x, y;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1313
	unsigned int width, height;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1314
	unsigned int dummy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1315
	int ret;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1316
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1317
	vRootWin = __WindowVal(__INST(virtualRootId));
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1318
	ENTER_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1319
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1320
					  &dummy, &dummy);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1321
	LEAVE_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1322
	if (ret) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1323
	    RETURN ( __MKPOINT_INT(width, height) );
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1324
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1325
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1326
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1327
    ^ width @ height
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1328
   "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1329
     Display virtualExtent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1330
     Display extent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1331
   "
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1332
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1333
    "Modified: / 03-05-2018 / 16:30:51 / stefan"
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1334
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1335
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1336
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1337
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1338
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1339
    ^ whitepixel
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1340
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1341
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1342
xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1343
    ^ xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1344
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1345
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1346
xlibTimeout:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1347
    xlibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1348
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1349
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1350
xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1351
    ^ xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1352
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1353
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1354
xlibTimeoutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1355
    xlibTimeoutForWindowCreation := seconds
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1356
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1357
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
  1358
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1359
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1360
extentOfResizeHandle
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1361
    "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
  1362
     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
  1363
     of the window.
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1364
     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
  1365
     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
  1366
     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
  1367
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1368
    OperatingSystem getOSType == #osx ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1369
	"/ 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
  1370
	"/ us a hint through the server vendor...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1371
	^ 16@16
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1372
    ].
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1373
    ^ 0@0
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1374
!
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1375
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1376
hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1377
    "return true, if this workstation supports the X cursor extension.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1378
     This extension allows for deep cursors (depth > 1)"
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1379
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1380
    ^ self hasExtension:'CURSOR'
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1381
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1382
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1383
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1384
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1385
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1386
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1387
hasDPS
186
claus
parents: 180
diff changeset
  1388
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
  1389
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
  1390
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1391
48194c26a46c Initial revision
claus
parents:
diff changeset
  1392
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
  1393
claus
parents: 180
diff changeset
  1394
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1395
     Display hasDPS
186
claus
parents: 180
diff changeset
  1396
    "
claus
parents: 180
diff changeset
  1397
!
claus
parents: 180
diff changeset
  1398
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1399
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1400
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1401
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
  1402
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
  1403
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1404
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1405
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1406
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1407
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1408
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1409
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1410
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1411
     && __isStringLike(extensionString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1412
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1413
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1414
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1415
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1416
	LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1417
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1418
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1419
%}
186
claus
parents: 180
diff changeset
  1420
claus
parents: 180
diff changeset
  1421
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1422
     Display hasExtension:'XVideo'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1423
     Display hasExtension:'Input'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1424
     Display hasExtension:'GLX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1425
     Display hasExtension:'X3D-PEX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1426
     Display hasExtension:'XInputExtension'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1427
     Display hasExtension:'SHAPE'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1428
     Display hasExtension:'MIT-SHM'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1429
     Display hasExtension:'SGIFullScreenStereo'
8670
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1430
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1431
     XQuartz supports the following:
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1432
	Apple-DRI
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1433
	Apple-WM
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1434
	BIG-REQUESTS
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1435
	DAMAGE
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1436
	DOUBLE-BUFFER
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1437
	GLX
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1438
	Generic Event Extension
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1439
	MIT-SCREEN-SAVER
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1440
	MIT-SHM
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1441
	Present
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1442
	RANDR
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1443
	RENDER
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1444
	SECURITY
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1445
	SGI-GLX
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1446
	SHAPE
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1447
	SYNC
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1448
	X-Resource
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1449
	XC-MISC
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1450
	XFIXES
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1451
	XINERAMA
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1452
	XInputExtension
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1453
	XKEYBOARD
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1454
	XVideo
186
claus
parents: 180
diff changeset
  1455
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1456
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1457
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1458
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1459
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1460
     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
  1461
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1462
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1463
    ^ hasImageExtension
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
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1466
     Display hasImageExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1467
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1468
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1469
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1470
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1471
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1472
     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
  1473
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1474
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1475
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1476
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1477
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1478
     Display hasInputExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1479
    "
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1482
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1483
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1484
     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
  1485
     enabled in the smalltalk system, for true to be returned."
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
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1488
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1489
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1490
     Display hasMultibuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1491
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1492
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1493
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1494
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1495
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1496
     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
  1497
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1498
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1499
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1500
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1501
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1502
     Display hasPEX
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1503
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1504
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1505
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1506
hasRenderExtension
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1507
    "return true, if this workstation supports the X render extension."
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1508
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1509
    ^ self hasExtension:'RENDER'
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1510
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1511
    "
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1512
     Display hasRenderExtension
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1513
    "
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1514
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1515
8415
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1516
hasSaveUnder:aBoolean
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1517
    "if the argument is false, a popup view's saveUnder will not be used
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1518
     - this can be used on servers where saveUnder is
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1519
     very slow or is broken (can be put into display-rc-file)"
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1520
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1521
    hasSaveUnder := aBoolean
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1522
8416
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1523
    "
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1524
     Screen current hasSaveUnder:false
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1525
    "
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1526
8415
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1527
    "Created: / 22-06-2018 / 10:47:25 / Claus Gittinger"
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1528
!
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1529
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1530
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1531
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1532
     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
  1533
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1534
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1535
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1536
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1537
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1538
     Display hasShm
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1539
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1540
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1541
8670
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1542
hasXTestExtension
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1543
    "return true, if this workstation supports the X cursor extension.
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1544
     This extension allows for deep cursors (depth > 1)"
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1545
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1546
    ^ self hasExtension:'XTEST'
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1547
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1548
    "
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1549
     Display hasExtension:'XTEST'
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1550
     Display hasXTestExtension
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1551
    "
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1552
!
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  1553
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1554
hasXVideo
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1555
    "return true, if this workstation supports the XVideo extension.
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1556
     Both the server must support it, and the feature must have been
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1557
     enabled in the smalltalk system, for true to be returned."
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1558
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1559
    ^ hasXVideoExtension
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1560
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1561
    "
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1562
     Display hasXVideo
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1563
    "
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1564
!
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1565
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1566
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1567
    "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
  1568
     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
  1569
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1570
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1571
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1572
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1573
7141
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1574
    count := 0.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1575
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1576
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1577
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1578
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1579
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1580
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1581
	Display *dpy = myDpy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1582
	int status;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1583
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1584
	ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1585
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1586
	LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1587
	if (status > 0) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1588
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1589
	   count = __MKSMALLINT(cnt);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1590
	}
7141
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1591
    }
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1592
%}.
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1593
    count == 0 ifTrue:[^ nil].
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1594
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1595
    ret := Array new:count.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1596
    1 to:count do:[ :i |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1597
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1598
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1599
%{
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1600
	XIconSize *slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1601
	minWidth = __MKSMALLINT(slp->min_width);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1602
	minHeight = __MKSMALLINT(slp->min_height);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1603
	maxWidth = __MKSMALLINT(slp->max_width);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1604
	maxHeight = __MKSMALLINT(slp->max_height);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1605
	widthStep = __MKSMALLINT(slp->width_inc);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1606
	heightStep = __MKSMALLINT(slp->height_inc);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1607
%}.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1608
	d := IdentityDictionary new:6.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1609
	d at:#minWidth put:minWidth.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1610
	d at:#maxWidth put:maxWidth.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1611
	d at:#widthStep put:widthStep.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1612
	d at:#minHeight put:minHeight.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1613
	d at:#maxHeight put:maxHeight.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1614
	d at:#heightStep put:heightStep.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1615
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1616
	ret at:i put:d.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1617
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1618
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1619
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1620
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1621
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1622
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1623
     Display iconSizes
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1624
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1625
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1626
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1627
ignoreBackingStore:aBoolean
7696
2e656340ab84 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7662
diff changeset
  1628
    "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
  1629
     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
  1630
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1631
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1632
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1633
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1634
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1635
monitorBounds
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  1636
    "ask the X server via the Xinerama extension about the available monitors.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1637
     The first monitor returned is the primary monitor"
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
    |numberOfMonitors resultArray bounds|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1640
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1641
%{
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1642
#ifdef XINERAMA
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1643
    if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1644
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1645
	XineramaScreenInfo *screenInfo;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1646
	int numDisplays;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1647
	OBJ *cResultArray;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1648
	int i, ci;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1649
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1650
	screenInfo = XineramaQueryScreens (dpy, &numDisplays);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1651
	if (screenInfo == 0) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1652
	    goto out;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1653
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1654
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1655
	numberOfMonitors = __mkSmallInteger(numDisplays);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1656
	resultArray = __ARRAY_NEW_INT(numDisplays * 5);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1657
	cResultArray = __ArrayInstPtr(resultArray)->a_element;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1658
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1659
	for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1660
	    cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1661
	    cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1662
	    cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1663
	    cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1664
	    cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1665
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1666
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1667
	XFree(screenInfo);
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1668
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1669
#endif
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1670
out:;
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1671
%}.
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1672
    numberOfMonitors isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1673
	"no xinerama - the display is the only monitor"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1674
	^ Array with:self bounds.
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1675
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1676
    rawMonitorBounds = resultArray ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1677
	^ monitorBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1678
    ].
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1679
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1680
    bounds := Array new:numberOfMonitors.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1681
    1 to:numberOfMonitors do:[:idx|
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1682
	|rect baseIdx|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1683
	baseIdx := (idx-1) * 5.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1684
	rect := Rectangle
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1685
		    left:(resultArray at:baseIdx+2)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1686
		    top:(resultArray at:baseIdx+3)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1687
		    width:(resultArray at:baseIdx+4)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1688
		    height:(resultArray at:baseIdx+5).
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1689
	bounds at:idx put:rect.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1690
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1691
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1692
    rawMonitorBounds := resultArray.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1693
    monitorBounds := bounds.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1694
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1695
    "since the monitor configuration changed,
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1696
     we have to update the monitor settings"
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1697
5892
491bf533899e added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5891
diff changeset
  1698
    self initializeScreenBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1699
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1700
    ^ bounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1701
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1702
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1703
     Display monitorBounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1704
    "
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  1705
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  1706
    "Modified: / 20-03-2018 / 12:20:18 / stefan"
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1707
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1708
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1709
monitorBoundsAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1710
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1711
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1712
    bounds := self monitorBounds.
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  1713
    ^ bounds
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1714
	detect:[:eachRectangle| eachRectangle containsPoint:aPoint]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1715
	ifNone:[super monitorBoundsAt:aPoint].
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1716
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1717
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1718
     Screen current monitorBoundsAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1719
     Screen current monitorBoundsAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1720
     Screen current monitorBoundsAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1721
     Screen current monitorBoundsAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1722
     Screen current monitorBoundsAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1723
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1724
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1725
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1726
numberOfMonitors
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1727
    ^ self monitorBounds size
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1728
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1729
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1730
	Display numberOfMonitors
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1731
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1732
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1733
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1734
pointIsVisible:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1735
    "is the point visible?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1736
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1737
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1738
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1739
    bounds := self monitorBounds.
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1740
    ^ bounds contains:[:eachRectangle| eachRectangle containsPoint:aPoint].
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1741
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1742
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1743
     Screen current pointIsVisible:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1744
     Screen current pointIsVisible:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1745
     Screen current pointIsVisible:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1746
     Screen current pointIsVisible:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1747
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1748
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1749
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1750
pointsAreOnSameMonitor:point1 and:point2
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1751
    "are the two points on the same (multi-screen) monitors?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1752
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1753
    ^ (self monitorBoundsAt:point1) = (self monitorBoundsAt:point2)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1754
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1755
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1756
preferredIconSize
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1757
    "return the display's preferred size for icons.
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1758
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1759
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1760
    self serverVendor = 'Silicon Graphics' ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  1761
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1762
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1763
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1764
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1765
    "Created: / 10-06-1996 / 21:06:48 / cg"
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1766
    "Modified (comment): / 01-09-2017 / 09:58:31 / cg"
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1767
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1768
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1769
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1770
    "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
  1771
     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
  1772
     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
  1773
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1774
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1775
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1776
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1777
smallestMonitorHeight
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1778
    "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
  1779
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1780
    |minH|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1781
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1782
    minH := self usableHeight.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1783
    self monitorBounds do:[:eachBounds |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1784
	minH := minH min: eachBounds height.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1785
    ].
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1786
    ^ minH
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1787
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1788
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1789
	Display smallestMonitorHeight
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1790
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1791
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1792
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1793
supportedClipboards
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1794
    "answer a collection of symbols with the supported clipboards.
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1795
     X11 additionaly supports a buffer containing the currently selected text
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1796
     (in xterm) - the PRIMARY selection"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1797
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1798
    ^ #(clipboard selection)
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1799
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1800
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1801
supportedImageFormats
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1802
    "return an array with supported image formats;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1803
     each array entry is an attribute dictionary, consisting of
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1804
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1805
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1806
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1807
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1808
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1809
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1810
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1811
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1812
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1813
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1814
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1815
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1816
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1817
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1818
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1819
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1820
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1821
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1822
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1823
    1 to:nFormats do:[:index |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1824
	|info bitsPerPixelInfo depthInfo paddingInfo i|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1825
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1826
	i := index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1827
%{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1828
	ScreenFormat *format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1829
	Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1830
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1831
#ifdef NO_PRIVATE_DISPLAY_ACCESS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1832
	depthInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1833
	bitsPerPixelInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1834
	paddingInfo = __MKSMALLINT(8);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1835
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1836
	format = DISPLAYACCESS(dpy)->pixmap_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1837
	format += (__intVal(i)-1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1838
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1839
	depthInfo = __MKSMALLINT(format->depth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1840
	paddingInfo = __MKSMALLINT(format->scanline_pad);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1841
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1842
%}.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1843
	info := IdentityDictionary new.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1844
	info at:#depth put:depthInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1845
	info at:#bitsPerPixel put:bitsPerPixelInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1846
	info at:#padding put:paddingInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1847
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1848
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1849
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1850
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1851
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1852
     Display supportedImageFormats
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1853
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1854
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1855
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1856
supportsAnyViewBackgroundPixmaps
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1857
    "return true, if the device allows pixmaps as viewBackground."
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1858
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1859
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1860
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1861
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1862
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1863
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1864
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1865
    "return true, if this workstation supports arbitrary shaped windows.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1866
     Both the server must support it (the shape-extension),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1867
     and the feature must have been enabled in the smalltalk system,
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1868
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1869
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1870
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1871
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1872
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1873
     Display supportsArbitraryShapedViews
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1874
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1875
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1876
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1877
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1878
    "return true, if this device supports views as icons.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1879
     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
  1880
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1881
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1882
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1883
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1884
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1885
     Display supportsIconViews
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1886
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1887
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1888
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1889
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1890
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1891
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1892
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1893
    "return true, if the device allows the given form pixmap
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1894
     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
  1895
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1896
7021
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1897
    ^ true
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1898
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1899
    "Created: / 4.5.1999 / 12:16:43 / cg"
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1900
!
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1901
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1902
supportsMaskedDrawingWithOffset:aForm
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1903
    "return true, if the device allows the given form pixmap
7022
f4531f98fd46 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7021
diff changeset
  1904
     to be used as paint color with a mask offset.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1905
     True returned here - X has no trouble with any mask."
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1906
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1907
    "/ XQuartz seems to have a bug here...
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  1908
    ^ OperatingSystem isOSXlike not.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1909
    "/ ^ true.
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1910
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1911
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1912
supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1913
    "return true, if the device allows reading the screen pixels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1914
     True returned here - X can do it"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1915
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1916
    "XQuartz seems to have a bug here...
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1917
     ...but only on XQuartz servers.
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1918
     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
  1919
     it does not return a valid server vendor string"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1920
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1921
	^ false
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1922
    ].
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1923
    ^ true
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1924
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1925
    "
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1926
     Display serverVendor
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1927
     Display supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1928
    "
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1929
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1930
    "Modified (comment): / 13-02-2017 / 20:35:34 / cg"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1931
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1932
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1933
supportsUTF8WindowLabels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1934
    "answer true, if window labels are to be utf-8 encoded"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1935
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1936
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1937
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1938
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1939
supportsVariableHeightFonts
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1940
    "are fonts with variable height supported?"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1941
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1942
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1943
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1944
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1945
supportsViewBackgroundPixmap:aForm
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1946
    "return true, if the device allows the given pixmap as viewBackground.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1947
     True returned here - X supports any size.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1948
     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
  1949
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1950
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1951
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1952
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1953
    "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
  1954
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1955
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1956
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1957
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1958
     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
  1959
     are faster, if they are."
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1960
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1961
    ^ true
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1962
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1963
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1964
supportsXCursor
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1965
    "return true, if the XCursor extension (deep cursors ) are supported
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1966
     on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1967
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1968
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1969
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1970
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1971
     ^ self class hasXCursorLibrary
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1972
	and:[self hasCursorExtension]
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1973
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1974
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1975
     Display supportsXCursor
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1976
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1977
     Display class hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1978
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1979
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1980
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1981
supportsXftFonts
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1982
    "return true, if XftFonts (nice looking truetype fonts)
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1983
     are supported on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1984
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1985
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1986
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1987
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  1988
     ^ XftFontDescription notNil and:[hasXftLibrary].
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1989
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1990
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1991
     Display supportsXftFonts
6975
da4fb0542fca #FEATURE
Claus Gittinger <cg@exept.de>
parents: 6958
diff changeset
  1992
     Display hasRenderExtension
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1993
     Display class hasXftLibrary
6538
04f9cecef7c3 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6522
diff changeset
  1994
    "
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1995
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1996
7699
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1997
supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1998
    "return true, if XftFonts (nice looking truetype fonts)
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1999
     are supported when drawing into bitmaps on this display.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2000
     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
  2001
     rendering into bitmaps"
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2002
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2003
     ^ false.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2004
     "/ ^ self supportsXftFonts
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2005
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2006
    "
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2007
     Display supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2008
     Display hasRenderExtension
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2009
     Display class hasXftLibrary
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2010
    "
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2011
!
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  2012
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2013
suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2014
    "return true, if this device wants to suppress shadow views
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2015
     (i.e. shadows under popups and modalBoxes).
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2016
     Some (slow) devices may want to return true here.
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  2017
     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
  2018
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2019
    OperatingSystem isOSXlike ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  2020
	^ true
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2021
    ].
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2022
    ^ super suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2023
!
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  2024
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2025
usableHeightAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2026
    "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
  2027
     Normally, the same as height, but may be smaller, in
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2028
     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
  2029
     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
  2030
     which display is at the given x-position"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2031
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  2032
    |h|
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  2033
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  2034
    h := (self monitorBoundsAt:aPoint) height.
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  2035
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2036
	"/ take away some space for the dock at the bottom.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  2037
	^ h - 50
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  2038
    ].
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  2039
    ^ h
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2040
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2041
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2042
     Screen current usableHeightAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2043
     Screen current usableHeightAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2044
     Screen current usableHeightAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2045
     Screen current usableHeightAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2046
     Screen current usableHeightAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  2047
    "
7965
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  2048
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  2049
    "Modified (format): / 05-03-2017 / 11:25:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2050
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2051
48194c26a46c Initial revision
claus
parents:
diff changeset
  2052
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2053
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2054
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  2055
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  2056
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  2057
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2058
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2059
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2060
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2061
    bitmapId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2062
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2063
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2064
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2065
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2066
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2067
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2068
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2069
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2070
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2071
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2072
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2073
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2074
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2075
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2076
     && __isStringLike(aString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2077
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2078
	char *filename;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2079
	int status;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2080
	Pixmap newBitmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2081
	unsigned b_width, b_height;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2082
	int b_x_hot, b_y_hot;
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
	filename = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2085
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2086
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2087
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2088
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2089
				 filename, &b_width, &b_height, &newBitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2090
				 &b_x_hot, &b_y_hot);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2091
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2092
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
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2095
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2096
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2097
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2098
	    w = __MKSMALLINT(b_width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2099
	    h = __MKSMALLINT(b_height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2100
	    id = __MKEXTERNALADDRESS(newBitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2101
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2102
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2103
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2104
    id notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2105
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2106
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2107
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2108
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2109
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2110
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2111
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2112
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2113
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2114
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2115
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2116
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2117
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2118
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2119
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2120
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2121
	Display *dpy = myDpy;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2122
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2123
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2124
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2125
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2126
				       __intVal(w), __intVal(h), 1);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2127
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2128
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2129
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2130
	    __cnt_bitmap++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2131
#endif
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2132
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2133
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2134
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2135
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2136
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2137
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2138
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2139
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2140
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  2141
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  2142
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2143
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2144
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2145
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2146
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2147
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2148
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2149
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2150
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2151
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2152
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2153
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2154
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2155
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2156
				       __intVal(w), __intVal(h), __intVal(d));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2157
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2158
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2159
	if (newBitmap)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2160
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2161
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2162
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2163
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2164
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  2165
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2166
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2167
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2168
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2169
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  2170
createWindowFor:aView type:typeSymbol
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2171
		 origin:origin
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2172
		 extent:extent
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2173
		 minExtent:minExt
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2174
		 maxExtent:maxExt
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2175
		 borderWidth:bWidth
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2176
		 subViewOf:wsuperView
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2177
		 style:wStyle
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2178
		 inputOnly:winputOnly
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2179
		 label:wlabel
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2180
		 owner:wowner
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2181
		 icon:wicon iconMask:wiconMask
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2182
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2183
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2184
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2185
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2186
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2187
     bColorId wsuperViewId windowId isTopWindow
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2188
     weventMask bitGravity viewGravity vBgColor
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  2189
     vBgForm deepForm preferredVisual preferredDepth
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2190
     wiconId wiconMaskId wiconViewId windowGroupWindowId|
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2191
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2192
    self isOpen ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2193
	self primitiveFailedOrClosedConnection.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2194
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2195
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2196
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2197
    origin notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2198
	xpos := origin x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2199
	ypos := origin y.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2200
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2201
    extent notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2202
	wwidth := extent x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2203
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2204
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2205
    minExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2206
	minWidth := minExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2207
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2208
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2209
    maxExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2210
	maxWidth := maxExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2211
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2212
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2213
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2214
    wsuperView notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2215
	wsuperViewId := wsuperView drawableId.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2216
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2217
	isTopWindow := true.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2218
	aView class ~~ WindowGroupWindow ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2219
	    windowGroupWindow isNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2220
		self getWindowGroupWindow.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2221
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2222
	    windowGroupWindowId := windowGroupWindow drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2223
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2224
	wicon notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2225
	    wiconId := wicon drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2226
	    wiconMask notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2227
		wiconMaskId := wiconMask drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2228
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2229
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2230
	wiconView notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2231
	    wiconViewId := wiconView drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2232
	].
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2233
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2234
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2235
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2236
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2237
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2238
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2239
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2240
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  2241
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2242
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2243
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2244
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2245
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2246
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2247
    XSizeHints sizehints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2248
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2249
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2250
    XFontStruct *f;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2251
    Pixmap backPixmap = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2252
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2253
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2254
    Atom WmQuitAppAtom, MotifWMHintsAtom;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  2255
    Atom STXDeviceAtom, UUIDAtom;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2256
    Atom atoms[3];
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2257
    int atomCount = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2258
48194c26a46c Initial revision
claus
parents:
diff changeset
  2259
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2260
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2261
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2262
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2263
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2264
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2265
    if (__bothSmallInteger(wwidth, wheight)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2266
	sizehints.flags |= PSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2267
	sizehints.width = __intVal(wwidth);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2268
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2269
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2270
    if (__bothSmallInteger(xpos, ypos)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2271
	sizehints.flags |= PPosition;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2272
	sizehints.x = __intVal(xpos);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2273
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2274
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2275
    if (__bothSmallInteger(minWidth, minHeight)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2276
	sizehints.flags |= PMinSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2277
	sizehints.min_width = __intVal(minWidth);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2278
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2279
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2280
    if (__bothSmallInteger(maxWidth, maxHeight)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2281
	sizehints.flags |= PMaxSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2282
	sizehints.max_width = __intVal(maxWidth);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2283
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2284
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2285
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  2286
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2287
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2288
    if (__isSmallInteger(bWidth)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2289
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2290
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2291
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2292
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2293
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2294
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2295
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2296
    if (__isExternalAddress(wsuperViewId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2297
	parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2298
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2299
	parentWindow = RootWindow(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2300
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2301
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  2302
    if (wStyle == @symbol(popUp))
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2303
	xswa.override_redirect = 1;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2304
    else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2305
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2306
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2307
    if (winputOnly == true)
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2308
	ioClass = InputOnly;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2309
    else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2310
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2311
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2312
    if (__isSmallInteger(weventMask)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2313
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2314
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2315
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2316
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2317
48194c26a46c Initial revision
claus
parents:
diff changeset
  2318
    if (ioClass == InputOnly) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2319
	bw = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2320
	depth = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2321
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2322
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2323
	depth = DefaultDepth(dpy,screen);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2324
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2325
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2326
	if (backPixmap != (Pixmap)0) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2327
	    xswa.background_pixmap = backPixmap;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2328
	    flags |= CWBackPixmap;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2329
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2330
	    xswa.background_pixel = bg;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2331
	    flags |= CWBackPixel;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2332
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2333
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2334
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2335
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2336
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2337
    if (__isSmallInteger(preferredDepth)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2338
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2339
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2340
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2341
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2342
    if (preferredVisual != nil) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2343
	XVisualInfo vi;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2344
	int cls;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2345
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2346
	if (preferredVisual == @symbol(StaticGray))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2347
	    cls = StaticGray;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2348
	else if (preferredVisual == @symbol(GrayScale))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2349
	    cls = GrayScale;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2350
	else if (preferredVisual == @symbol(StaticColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2351
	    cls = StaticColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2352
	else if (preferredVisual == @symbol(PseudoColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2353
	    cls = PseudoColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2354
	else if (preferredVisual == @symbol(TrueColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2355
	    cls = TrueColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2356
	else if (preferredVisual == @symbol(DirectColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2357
	    cls = DirectColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2358
	else
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2359
	    cls = PseudoColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2360
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2361
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2362
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2363
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  2364
/*
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2365
	    console_fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  2366
*/
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2367
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2368
	LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2369
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2370
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2371
    ENTER_XLIB2();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2372
    newWindow = XCreateWindow(dpy, parentWindow,
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2373
			   sizehints.x, sizehints.y,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2374
			   sizehints.width, sizehints.height,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2375
			   bw, depth, ioClass, &visual,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2376
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2377
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2378
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2379
48194c26a46c Initial revision
claus
parents:
diff changeset
  2380
    if (! newWindow) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2381
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2382
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2383
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2384
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2385
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2386
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2387
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2388
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  2389
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  2390
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  2391
     */
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2392
    if (isTopWindow == true) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2393
	XWMHints wmhints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2394
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2395
	wmhints.flags = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2396
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2397
	if (__isExternalAddress(wiconId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2398
	    wmhints.icon_pixmap = __PixmapVal(wiconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2399
	    wmhints.flags = IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2400
	    if (__isExternalAddress(wiconMaskId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2401
		wmhints.icon_mask = __PixmapVal(wiconMaskId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2402
		wmhints.flags |= IconMaskHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2403
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2404
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2405
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2406
	if (__isExternalAddress(windowGroupWindowId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2407
	    wmhints.window_group = __WindowVal(windowGroupWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2408
	    wmhints.flags |= WindowGroupHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2409
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2410
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2411
	if (__isExternalAddress(wiconViewId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2412
	    wmhints.flags |= IconWindowHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2413
	    wmhints.icon_window = __WindowVal(wiconViewId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2414
	};
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2415
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2416
/*
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2417
	wmhints.flags |= InputHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2418
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2419
*/
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2420
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2421
	XSetWMHints(dpy, newWindow, &wmhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2422
	XSetWMNormalHints(dpy, newWindow, &sizehints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2423
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2424
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2425
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2426
	 * get atoms first (if not already known)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2427
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2428
	if (__INST(protocolsAtom) == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2429
	    ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2430
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2431
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2432
#ifdef USE_SAVEYOURSELF_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2433
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2434
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2435
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2436
#ifdef USE_QUIT_APP_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2437
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2438
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2439
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2440
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2441
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2442
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2443
	    UUIDAtom = XInternAtom(dpy, "UUID", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2444
	    __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2445
	    STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2446
	    __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2447
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2448
	    LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2449
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2450
#ifdef USE_QUIT_APP_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2451
	    WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2452
#else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2453
	    WmQuitAppAtom = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2454
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2455
	    WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2456
	    WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2457
#ifdef USE_SAVEYOURSELF_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2458
	    WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2459
#else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2460
	    WmSaveYourselfAtom = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2461
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2462
	    UUIDAtom = __AtomVal(__INST(uuidAtom));;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2463
	    STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2464
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2465
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2466
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2467
	 * tell window manager to not kill us but send an event instead
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2468
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2469
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2470
#ifdef USE_SAVEYOURSELF_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2471
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2472
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2473
#ifdef USE_QUIT_APP_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2474
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2475
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2476
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2477
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2478
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2479
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2480
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2481
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2482
	 * an optional unique id (to mark stx-windows)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2483
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2484
	if (__isBytes(__INST(uniqueDeviceID))) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2485
	    int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2486
	    unsigned char uuidBytes[32];
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2487
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2488
	    if (numUUIDBytes <= sizeof(uuidBytes)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2489
		Atom uuidAtom;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2490
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2491
		bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2492
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2493
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2494
		XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2495
				 uuidBytes, numUUIDBytes );
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2496
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2497
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2498
	}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2499
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2500
#ifdef SUPPORT_MOTIF_WM_HINTS
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2501
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2502
	 * less decoration
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2503
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2504
	if ((wStyle == @symbol(undecorated))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2505
	 || (wStyle == @symbol(dialog2))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2506
	 || (wStyle == @symbol(notitle))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2507
	) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2508
	    if (__INST(motifWMHintsAtom) == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2509
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2510
		MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2511
		__INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2512
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2513
	    } else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2514
		MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2515
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2516
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2517
	    {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2518
		struct hints {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2519
		    unsigned long flags;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2520
		    unsigned long functions;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2521
		    unsigned long decorations;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2522
		    long input_mode;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2523
		    unsigned long status;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2524
		} mvm_hints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2525
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2526
		if (wStyle == @symbol(undecorated)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2527
		    mvm_hints.decorations = MWM_DECOR_NONE;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2528
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2529
		if (wStyle == @symbol(dialog2)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2530
		    mvm_hints.decorations = MWM_DECOR_BORDER
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2531
					    | MWM_DECOR_RESIZEH
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2532
					    | MWM_DECOR_TITLE
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2533
					    /* | MWM_DECOR_MENU */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2534
					    /* | MWM_DECOR_MINIMIZE */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2535
					    /* | MWM_DECOR_MAXIMIZE */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2536
					    ;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2537
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2538
		if (wStyle == @symbol(notitle)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2539
		    mvm_hints.decorations = MWM_DECOR_BORDER
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2540
					    /* | MWM_DECOR_RESIZEH  */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2541
					    /* | MWM_DECOR_TITLE    */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2542
					    /* | MWM_DECOR_MENU     */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2543
					    /* | MWM_DECOR_MINIMIZE */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2544
					    /* | MWM_DECOR_MAXIMIZE */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2545
					    ;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2546
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2547
		mvm_hints.flags =  MWM_HINTS_DECORATIONS;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2548
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2549
		XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2550
				     MotifWMHintsAtom, 32, PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2551
				     (unsigned char*)&mvm_hints, 5 );
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2552
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2553
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2554
	}
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  2555
#endif /* SUPPORT_MOTIF_WM_HINTS */
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2556
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2557
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2558
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2559
%}.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2560
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2561
"/    (wStyle ~= nil and:[wStyle ~= #normal]) ifTrue:[
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2562
"/        self setWindowType:wStyle in:windowId.
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2563
"/    ].
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2564
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2565
    (wsuperView isNil "this is a topwindow"
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2566
     and:[wlabel notEmptyOrNil]) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2567
	self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2568
	    setIconName:wlabel in:windowId;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2569
	    setWindowName:wlabel in:windowId.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2570
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2571
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
  2572
    self addKnownView:aView withId:windowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2573
    ^ windowId
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2574
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2575
    "Modified: / 09-01-2013 / 10:43:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2576
    "Modified: / 26-04-2018 / 11:02:09 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2577
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2578
48194c26a46c Initial revision
claus
parents:
diff changeset
  2579
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2580
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2581
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2582
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2583
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2584
     * 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
  2585
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2586
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2587
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2588
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2589
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2590
    if (__isExternalAddress(aGCId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2591
	GC gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2592
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2593
	if (gc) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2594
	    __ExternalAddressInstPtr(aGCId)->e_address = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2595
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2596
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2597
	    XFreeGC(myDpy, gc);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2598
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2599
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2600
	    __cnt_gc--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2601
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2602
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2603
	    console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2604
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2605
	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
  2606
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2607
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2608
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2609
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2610
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2611
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2612
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2613
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2614
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2615
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2616
     * 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
  2617
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2618
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2619
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2620
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2621
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2622
    if (__isExternalAddress(aDrawableId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2623
	Pixmap pix = __PixmapVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2624
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2625
	if (pix) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2626
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2627
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2628
	    XFreePixmap(myDpy, pix);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2629
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2630
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2631
	    __cnt_bitmap--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2632
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2633
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2634
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2635
	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
  2636
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2637
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2638
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2639
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2640
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2641
destroyView:aViewOrNil withId:aWindowId
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2642
    XftFontDescription notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  2643
	XftFontDescription aboutToDestroyViewWithDevice:self id:aWindowId.
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2644
    ].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2645
    self primDestroyViewWithId:aWindowId.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2646
    self removeKnownView:aViewOrNil withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2647
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2648
48194c26a46c Initial revision
claus
parents:
diff changeset
  2649
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2650
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2651
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2652
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2653
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2654
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2655
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2656
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2657
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2658
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2659
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2660
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2661
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2662
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2663
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2664
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2665
				       __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2666
				       0, height, 0, colormap, NULL, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2667
				       XDPSDefaultTextBackstop,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2668
				       XDPSDefaultErrorProc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2669
				       NULL);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2670
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2671
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2672
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2673
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2674
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2675
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2676
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2677
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2678
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2679
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2680
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2681
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2682
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2683
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2684
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2685
    GC gc;
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 (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2688
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2689
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2690
	gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2691
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2692
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2693
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2694
	if (gc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2695
	    __cnt_gc++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2696
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2697
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2698
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2699
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2700
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2701
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2702
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2703
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2704
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2705
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2706
    "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
  2707
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2708
    ^ self gcFor:aDrawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2709
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2710
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2711
primCreateBitmapFromArray:anArray width:w height:h
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2712
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2713
154
claus
parents: 153
diff changeset
  2714
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2715
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2716
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2717
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2718
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2719
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2720
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2721
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2722
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2723
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2724
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2725
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2726
    static char reverseBitTable[256];
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  2727
    static int firstCall = 1;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2728
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2729
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2730
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2731
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2732
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2733
    if (! ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2734
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2735
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2736
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2737
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2738
    if (firstCall) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2739
	for (index=0; index < 256; index++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2740
	    int t = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2741
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2742
	    if (index & 128) t |=   1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2743
	    if (index &  64) t |=   2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2744
	    if (index &  32) t |=   4;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2745
	    if (index &  16) t |=   8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2746
	    if (index &   8) t |=  16;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2747
	    if (index &   4) t |=  32;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2748
	    if (index &   2) t |=  64;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2749
	    if (index &   1) t |= 128;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2750
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2751
	    reverseBitTable[index] = t;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2752
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2753
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2754
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2755
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2756
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2757
	newBitmap = (Pixmap)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2758
	b_width = __intVal(w);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2759
	b_height = __intVal(h);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2760
	bytesPerRow = (b_width + 7) / 8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2761
	nBytes = b_height * bytesPerRow;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2762
	if (nBytes < sizeof(fastBits)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2763
	    cp = b_bits = fastBits;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2764
	    allocatedBits = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2765
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2766
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2767
	    if (! cp) goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2768
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2769
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2770
	if (__isArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2771
	    index = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2772
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2773
	    for (row = b_height; row; row--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2774
		for (col = bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2775
		    num = *op++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2776
		    if (__isSmallInteger(num)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2777
			bits = __intVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2778
		    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2779
			bits = __longIntVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2780
			if (bits == 0) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2781
			    goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2782
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2783
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2784
		    *cp++ = reverseBitTable[bits & 0xFF];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2785
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2786
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2787
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2788
	    if (__isByteArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2789
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2790
		for (col = b_height*bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2791
		    *cp++ = reverseBitTable[*pBits++];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2792
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2793
	    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2794
		goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2795
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2796
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2797
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2798
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2799
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2800
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2801
					       (char *)b_bits,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2802
					       b_width, b_height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2803
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2804
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2805
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2806
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2807
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2808
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2809
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2810
fail: ;
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2811
	if (allocatedBits)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2812
	    free(allocatedBits);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2813
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2814
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2815
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2816
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2817
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2818
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2819
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
  2820
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2821
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2822
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2823
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2824
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2825
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2826
primDestroyViewWithId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2827
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2828
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2829
    if (! ISCONNECTED) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2830
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2831
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2832
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2833
    if (__isExternalAddress(aWindowId)) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2834
	Window win = __WindowVal(aWindowId);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2835
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2836
	if (win) {
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2837
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2838
	    ENTER_XLIB();
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2839
	    XDestroyWindow(myDpy, win);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2840
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2841
#ifdef COUNT_RESOURCES
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2842
	    __cnt_view--;
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2843
#endif
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2844
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2845
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2846
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2847
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2848
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2849
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2850
!XWorkstation methodsFor:'clipboard'!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2851
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2852
getPrimaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2853
    "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
  2854
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2855
    ^ primaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2856
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2857
    "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
  2858
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2859
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2860
primaryBufferAsString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2861
    "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
  2862
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
  2863
    ^ self class bufferAsString:self getPrimaryBuffer.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2864
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2865
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2866
setPrimaryBuffer:aString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2867
    "Sets the contents of PRIMARY selection."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2868
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2869
    primaryBuffer := aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2870
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2871
    "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
  2872
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2873
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2874
setPrimaryText:aString ownerView:aView
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2875
    "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
  2876
     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
  2877
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2878
    |s viewID|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2879
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2880
    self setPrimaryBuffer:aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2881
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2882
    s := aString ? ''.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2883
    s isString ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2884
	s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2885
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2886
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2887
    viewID := aView drawableId.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2888
    viewID notNil ifTrue:[ "/ if the view is not already closed
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2889
	"/ for now - should add support to pass emphasis information too
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2890
	s := s string.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2891
	self setPrimaryText:s owner:viewID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2892
    ]
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2893
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2894
    "Created: / 27-03-2012 / 14:46:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2895
    "Modified: / 26-04-2018 / 11:00:43 / stefan"
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2896
! !
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2897
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2898
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2899
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2900
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2901
    "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
  2902
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2903
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2904
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2905
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2906
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2907
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2908
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2909
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2910
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2911
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2912
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2913
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2914
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2915
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2916
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2917
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2918
				   &dummy, 0, &color.pixel, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2919
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2920
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2921
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2922
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2923
	    __cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2924
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2925
	    RETURN ( __MKSMALLINT(color.pixel) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2926
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2927
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2928
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2929
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2930
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2931
48194c26a46c Initial revision
claus
parents:
diff changeset
  2932
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
  2933
    "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
  2934
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2935
     and the returned colorID is formed by simply packing the RGB values.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2936
     Don't use this method, colornames are mostly X specific."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2937
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2938
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2939
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2940
48194c26a46c Initial revision
claus
parents:
diff changeset
  2941
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2942
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2943
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2944
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2945
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2946
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2947
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2948
     && __isStringLike(aString)) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2949
	Display *dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2950
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2951
	colorname = (char *) __stringVal(aString);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2952
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2953
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2954
	ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2955
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2956
	LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2957
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2958
#ifdef QUICK_TRUE_COLORS
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2959
	    if (__INST(visualType) == @symbol(TrueColor)) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2960
		id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2961
		id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2962
		id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2963
		RETURN ( __MKSMALLINT(id) );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2964
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2965
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2966
	    ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2967
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2968
	    LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2969
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2970
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2971
	if (! ok) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2972
	    RETURN ( nil );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2973
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2974
#ifdef COUNT_RESOURCES
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2975
	__cnt_color++;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2976
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2977
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2978
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2979
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2980
    ^ 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
  2981
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2982
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2983
colorScaledRed:r scaledGreen:g scaledBlue:b
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2984
    "allocate a color with rgb values (0..16rFFFF)
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2985
     - return the color index (i.e. colorID).
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2986
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2987
     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
  2988
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2989
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2990
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2991
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2992
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2993
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2994
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2995
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2996
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2997
    if (__bothSmallInteger(r, g)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2998
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2999
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3000
	ecolor.red = __intVal(r);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3001
	ecolor.green= __intVal(g);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3002
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  3003
#ifdef QUICK_TRUE_COLORS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3004
	if (__INST(visualType) == @symbol(TrueColor)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3005
	    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
  3006
	    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
  3007
	    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
  3008
	    RETURN ( __MKSMALLINT(id) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3009
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3010
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3011
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3012
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3013
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3014
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3015
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3016
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3017
	if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3018
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3019
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3020
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3021
	__cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3022
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3023
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3024
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3025
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3026
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3027
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3028
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3029
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3030
    "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
  3031
     x-component value (0..100)"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3032
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3033
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3034
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3035
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3036
     Display deviceColorValueToPercent:0
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3037
     Display deviceColorValueToPercent:16r8000
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3038
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3039
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3040
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3041
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3042
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3043
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3044
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3045
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3046
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3047
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  3048
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3049
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3050
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3051
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  3052
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3053
    if (__INST(visualType) == @symbol(TrueColor)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3054
	/* no need to do anything on TrueColor displays ... */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3055
	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
  3056
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3057
#endif
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3058
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3059
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3060
     * 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
  3061
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3062
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3063
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3064
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3065
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3066
    if (__isSmallInteger(colorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3067
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3068
	color = (long) __intVal(colorIndex);
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3071
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3072
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3073
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3074
	__cnt_color--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3075
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3076
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3077
	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
  3078
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3079
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3080
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3081
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3082
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3083
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
  3084
    "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
  3085
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3086
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3087
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3088
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3089
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3090
    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
  3091
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3092
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3093
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3094
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3095
     && __isSmallInteger(index)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3096
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3097
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3098
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3099
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3100
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3101
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3102
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3103
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3104
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3105
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3106
	 * 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
  3107
	 * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3108
	 * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3109
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3110
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3111
	bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3112
	scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3113
	shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3114
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3115
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3116
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3117
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3118
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3119
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3120
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3121
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3122
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3123
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3124
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
  3125
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3126
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3127
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3128
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3129
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3130
    XColor color;
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3131
    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
  3132
    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
  3133
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3134
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3135
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  3136
     && __isStringLike(colorName)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3137
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3138
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3139
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3140
	if (XParseColor(dpy, DefaultColormap(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3141
			     (char *) __stringVal(colorName), &color)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3142
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3143
	     * 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
  3144
	     * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3145
	     * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3146
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3147
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3148
	    bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3149
	    scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3150
	    shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3151
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3152
	    /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3153
	    dr = color.red>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3154
	    dg = color.green>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3155
	    db = color.blue>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3156
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3157
	    sr = (dr / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3158
	    sg = (dg / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3159
	    sb = (db / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3160
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3161
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3162
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3163
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3164
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3165
    ^ super getScaledRGBFromName:colorName
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3166
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3167
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3168
	Screen current getScaledRGBFromName:'red'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3169
	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
  3170
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3171
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3172
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3173
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3174
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3175
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3176
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3177
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3178
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3179
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  3180
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3181
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3182
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3183
    [aStream atEnd] whileFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3184
	line := aStream nextLine.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3185
	line notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3186
	    "skip the r/g/b numbers"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3187
	    index := 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3188
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3189
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3190
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3191
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3192
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3193
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3194
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3195
	    colorName := line copyFrom:index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3196
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3197
		list add:colorName
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3198
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3199
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3200
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3201
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3202
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3203
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3204
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3205
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3206
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3207
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3208
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3209
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3210
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3211
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3212
    "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
  3213
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3214
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3215
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3216
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3217
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3218
    if (__isSmallInteger(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3219
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3220
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3221
    if (__isFloat(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3222
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3223
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3224
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3225
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3226
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3227
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3228
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
  3229
    "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
  3230
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3231
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3232
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3233
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3234
48194c26a46c Initial revision
claus
parents:
diff changeset
  3235
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3236
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3237
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3238
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3239
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3240
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3241
    if (__isSmallInteger(sred))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3242
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3243
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3244
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3245
    if (__isSmallInteger(sgreen))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3246
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3247
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3248
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3249
    if (__isSmallInteger(sblue))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3250
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3251
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3252
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3253
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3254
     && __isSmallInteger(index) && ok) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3255
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3256
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3257
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3258
	color.red = r;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3259
	color.green = g;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3260
	color.blue = b;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3261
	color.flags = DoRed | DoGreen | DoBlue;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3262
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3263
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3264
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3265
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3266
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3267
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3268
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3269
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3270
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3271
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3272
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3273
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3274
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3275
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3276
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3277
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3278
     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
  3279
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3280
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3281
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3282
    "/ 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
  3283
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3284
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3285
	#upLeftArrow            "/ XC_top_left_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3286
	#upRightHand            "/ XC_hand1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3287
	#upDownArrow            "/ XC_sb_v_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3288
	#leftRightArrow         "/ XC_sb_h_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3289
	#upLimitArrow           "/ XC_top_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3290
	#downLimitArrow         "/ XC_bottom_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3291
	#leftLimitArrow         "/ XC_left_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3292
	#rightLimitArrow        "/ XC_right_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3293
	#text                   "/ XC_xterm
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3294
	#upRightArrow           "/ XC_draft_large
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3295
	#leftHand               "/ XC_hand2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3296
	#questionMark           "/ XC_question_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3297
	#cross                  "/ XC_X_cursor
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3298
	#wait                   "/ XC_watch
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3299
	#crossHair              "/ XC_tcross
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3300
	#origin                 "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3301
	#topLeft                "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3302
	#corner                 "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3303
	#bottomRight            "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3304
	#topRight               "/ XC_ur_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3305
	#bottomLeft             "/ XC_ll_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3306
	#square                 "/ XC_dotbox
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3307
	#fourWay                "/ XC_fleur
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3308
	#crossCursor            "/ XC_X_cursor
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3309
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3310
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3311
    "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
  3312
    "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
  3313
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3314
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3315
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3316
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3317
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3318
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3319
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3320
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3321
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3322
    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
  3323
    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
  3324
    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
  3325
    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
  3326
    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
  3327
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3328
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3329
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3330
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3331
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3332
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3333
     && __bothSmallInteger(fgG, fgB)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3334
     && __bothSmallInteger(bgR, bgG)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3335
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3336
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3337
	fgcolor.red = __intVal(fgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3338
	fgcolor.green= __intVal(fgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3339
	fgcolor.blue = __intVal(fgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3340
	bgcolor.red = __intVal(bgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3341
	bgcolor.green= __intVal(bgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3342
	bgcolor.blue = __intVal(bgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3343
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3344
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3345
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3346
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3347
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3348
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  3349
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3350
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3351
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3352
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3353
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3354
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3355
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3356
     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
  3357
     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
  3358
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3359
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3360
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3361
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3362
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3363
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3364
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3365
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3366
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
  3367
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3368
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3369
    ^ self
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3370
	primCreateCursorSourceFormId:sourceForm drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3371
	maskFormId:maskForm drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3372
	hotX:hx hotY:hy
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3373
	width:w height:h
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3374
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3375
    "Modified: / 26-04-2018 / 11:02:52 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3376
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3377
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3378
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3379
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3380
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3381
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3382
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3383
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3384
     * 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
  3385
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3386
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3387
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3388
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3389
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3390
    if (__isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3391
	Cursor curs = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3392
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3393
	if (curs) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3394
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3395
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3396
	    XFreeCursor(myDpy, curs);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3397
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3398
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3399
	    __cnt_cursor--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3400
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3401
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3402
	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
  3403
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3404
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3405
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3406
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3407
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3408
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3409
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3410
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3411
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3412
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3413
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3414
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3415
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3416
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3417
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3418
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3419
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3420
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3421
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3422
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3423
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3424
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3425
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3426
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3427
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3428
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3429
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3430
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3431
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3432
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3433
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3434
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3435
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3436
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3437
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3438
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3439
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3440
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3441
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3442
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3443
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3444
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3445
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3446
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3447
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3448
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3449
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3450
     && __bothSmallInteger(hx, hy)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3451
	fgColor.red = 0;        /* fg is black */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3452
	fgColor.green = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3453
	fgColor.blue = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3454
	bgColor.red = 0xFFFF;   /* bg is white */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3455
	bgColor.green = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3456
	bgColor.blue = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3457
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3458
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3459
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3460
	newCursor = XCreatePixmapCursor(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3461
				__PixmapVal(sourceId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3462
				__PixmapVal(maskId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3463
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3464
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3465
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3466
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3467
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3468
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3469
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3470
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3471
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3472
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3473
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3474
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3475
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3476
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3477
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3478
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3479
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3480
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3481
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3482
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3483
    "/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
  3484
    "/ 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
  3485
6873
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3486
%{  /* NOCONTEXT */
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3487
    if (shape == @symbol(upLeftArrow)) RETURN ( __MKSMALLINT(XC_top_left_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3488
    if (shape == @symbol(upRightHand)) RETURN (  __MKSMALLINT(XC_hand1) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3489
    if (shape == @symbol(upDownArrow)) RETURN (  __MKSMALLINT(XC_sb_v_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3490
    if (shape == @symbol(leftRightArrow)) RETURN (  __MKSMALLINT(XC_sb_h_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3491
    if (shape == @symbol(upLimitArrow)) RETURN (  __MKSMALLINT(XC_top_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3492
    if (shape == @symbol(downLimitArrow)) RETURN (  __MKSMALLINT(XC_bottom_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3493
    if (shape == @symbol(leftLimitArrow)) RETURN (  __MKSMALLINT(XC_left_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3494
    if (shape == @symbol(rightLimitArrow)) RETURN (  __MKSMALLINT(XC_right_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3495
    if (shape == @symbol(text)) RETURN (  __MKSMALLINT(XC_xterm) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3496
    if (shape == @symbol(upRightArrow)) RETURN (  __MKSMALLINT(XC_draft_large) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3497
    if (shape == @symbol(leftHand)) RETURN (  __MKSMALLINT(XC_hand2) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3498
    if (shape == @symbol(questionMark)) RETURN (  __MKSMALLINT(XC_question_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3499
    if (shape == @symbol(cross)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3500
    if (shape == @symbol(wait)) RETURN (  __MKSMALLINT(XC_watch) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3501
    if (shape == @symbol(crossHair)) RETURN (  __MKSMALLINT(XC_tcross) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3502
    if ((shape == @symbol(origin)) || (shape == @symbol(topLeft))) RETURN (  __MKSMALLINT(XC_ul_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3503
    if ((shape == @symbol(corner)) || (shape == @symbol(bottomRight))) RETURN ( __MKSMALLINT(XC_lr_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3504
    if (shape == @symbol(topRight)) RETURN (  __MKSMALLINT(XC_ur_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3505
    if (shape == @symbol(bottomLeft)) RETURN (  __MKSMALLINT(XC_ll_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3506
    if (shape == @symbol(square)) RETURN (  __MKSMALLINT(XC_dotbox) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3507
    if (shape == @symbol(fourWay)) RETURN (  __MKSMALLINT(XC_fleur) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3508
    if (shape == @symbol(crossCursor)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3509
%}.
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7416
diff changeset
  3510
"/    Logger info:'invalid cursorShape: %1' with:shape.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3511
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3512
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3513
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3514
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3515
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3516
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3517
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3518
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3519
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3520
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3521
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3522
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3523
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3524
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3525
	"/ DND can drop files, file, dir, links, dirLink and text
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3526
	"/ check for this.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3527
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3528
	dropObjects isCollection ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3529
	    dropColl := Array with:dropObjects
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3530
	] ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3531
	    dropColl := dropObjects
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3532
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3533
	anyFile := anyDir := anyText := anyOther := false.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3534
	dropColl do:[:aDropObject |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3535
	    aDropObject isFileObject ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3536
		aDropObject theObject isDirectory ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3537
		    anyDir := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3538
		] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3539
		    anyFile := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3540
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3541
	    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3542
		aDropObject isTextObject ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3543
		    anyText := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3544
		] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3545
		    anyOther := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3546
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3547
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3548
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3549
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3550
	anyOther ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3551
	    "/ DND does not support this ...
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3552
	    Logger info:'DND can only drop files or text'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3553
	    ^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3554
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3555
	anyText ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3556
	    (anyFile or:[anyDir]) ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3557
		"/ DND does not support mixed types
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3558
		Logger info:'DND cannot drop both files and text'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3559
		^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3560
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3561
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3562
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3563
	dropCollSize := dropColl size.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3564
	anyFile ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3565
	    dropType := #DndFiles.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3566
	    dropCollSize == 1 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3567
		dropType := #DndFile
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3568
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3569
	] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3570
	    anyDir ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3571
		dropType := #DndFiles.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3572
		dropCollSize == 1 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3573
		    dropType := #DndDir
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3574
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3575
	    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3576
		anyText ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3577
		    dropCollSize == 1 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3578
			dropType := #DndText
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3579
		    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3580
			"/ can only drop a single text object
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3581
			Logger info:'DND can only drop a single text'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3582
			^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3583
		    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3584
		] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3585
		    "/ mhmh ...
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3586
		    Logger info:'DND cannot drop this'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3587
		    ^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3588
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3589
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3590
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3591
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3592
	dropTypeCode := self dndDropTypes indexOf:dropType.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3593
	dropTypeCode == 0 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3594
	    Logger info:'DND cannot drop this'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3595
	    ^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3596
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3597
	dropTypeCode := dropTypeCode - 1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3598
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3599
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3600
	"/ place the selection inTo the DndSelection property
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3601
	"/ of the rootView ...
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3602
	"/ ... need a single string, with 0-terminated parts.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3603
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3604
	strings := OrderedCollection new.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3605
	sz := 0.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3606
	dropColl do:[:anObject |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3607
	    |s o|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3608
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3609
	    o := anObject theObject.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3610
	    anObject isFileObject ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3611
		o := o pathName
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3612
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3613
	    s := o asString.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3614
	    strings add:s.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3615
	    sz := sz + (s size) + 1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3616
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3617
	val := String new:sz.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3618
	idx := 1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3619
	strings do:[:aString |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3620
	    |sz|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3621
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3622
	    sz := aString size.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3623
	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3624
	    idx := idx + sz.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3625
	    val at:idx put:(Character value:0).
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3626
	    idx := idx + 1
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3627
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3628
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3629
	self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3630
	    setProperty:#DndSelection
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3631
	    type:#STRING
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3632
	    value:val
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3633
	    for:rootId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3634
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3635
	^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3636
	    sendClientEvent:msgType
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3637
	    format:32
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3638
	    to:destinationId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3639
	    propagate:true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3640
	    eventMask:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3641
	    window:destinationId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3642
	    data1:dropTypeCode
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3643
	    data2:0
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3644
	    data3:destinationId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3645
	    data4:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3646
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3647
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3648
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3649
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3650
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3651
    "Created: / 06-04-1997 / 13:39:37 / cg"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3652
    "Modified: / 26-04-2018 / 10:54:18 / stefan"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3653
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3654
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3655
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3656
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3657
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3658
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3659
	    DndUnknown      "/ 0
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3660
	    DndRawData      "/ 1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3661
	    DndFile         "/ 2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3662
	    DndFiles        "/ 3
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3663
	    DndText         "/ 4
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3664
	    DndDir          "/ 5
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3665
	    DndLink         "/ 6
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3666
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3667
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3668
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3669
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3670
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3671
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3672
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3673
dndMessage:event data:data view:targetView
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3674
    "handle a drag&drop protocol message"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3675
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3676
    |sensor property dropType dropValue propertyType|
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3677
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3678
    dropType := data doubleWordAt:1.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3679
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3680
    "/ see def's in DragAndDropTypes.h
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3681
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3682
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3683
    property := self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3684
		    getProperty:#DndSelection
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3685
		    from:rootId
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3686
		    delete:false.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3687
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3688
    propertyType := property key.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3689
    dropValue := property value.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3690
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3691
    "/ preconvert into a collection
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3692
    "/ of fileNames, string or byteArray
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3693
    "/ Notice: we do not yet convert into dropObjects
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3694
    "/ here, to allow arbitrary data to be handled by
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3695
    "/ redefined dropMessage methods in applications.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3696
    "/ Conversion is done for some well known types
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3697
    "/ in the default dropMessage handling of SimpleView.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3698
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3699
    dropType == #DndFiles ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3700
	"/ actually, a list of fileNames
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3701
	dropValue firstOrNil isString ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3702
	    Logger info:'expected a string propertyValue in drop'.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3703
	    ^ self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3704
	].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3705
	dropValue := dropValue collect:[:nm | nm asFilename].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3706
	dropType := #files.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3707
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3708
	dropValue isString ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3709
	    Logger info:'expected a string propertyValue in drop'.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3710
	    ^ self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3711
	].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3712
	dropValue := dropValue asFilename.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3713
	dropType := #file.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3714
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3715
	dropValue isString ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3716
	    Logger info:'expected a string propertyValue in drop'.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3717
	    ^ self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3718
	].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3719
	dropValue := dropValue asFilename.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3720
	dropType := #directory.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3721
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3722
	(dropValue isString or:[dropValue isStringCollection]) ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3723
	    Logger info:'expected a string propertyValue in drop'.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3724
	    ^ self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3725
	].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3726
	dropValue := dropValue asString.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3727
	dropType := #text.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3728
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3729
	dropValue isString ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3730
	    Logger info:'expected a string propertyValue in drop'.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3731
	    ^ self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3732
	].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3733
	dropType := #executable.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3734
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3735
	dropValue isString ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3736
	    Logger info:'expected a string propertyValue in drop'.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3737
	    ^ self
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3738
	].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3739
	dropType := #link.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3740
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3741
	dropType := #rawData.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3742
    ] ifFalse:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3743
	Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3744
	dropType := #unknown.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3745
    ]]]]]]].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3746
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3747
    sensor := targetView sensor.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3748
    "not posted, if there is no sensor ..."
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3749
    sensor notNil ifTrue:[
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3750
	sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3751
    ].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3752
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3753
    "Created: / 04-04-1997 / 17:59:37 / cg"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3754
    "Modified (format): / 25-04-2018 / 15:12:04 / stefan"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3755
!
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3756
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3757
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3758
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3759
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3760
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3761
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3762
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3763
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3764
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3765
	^ self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3766
	    dndDrop:aCollectionOfDropObjects
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3767
	    inWindowID:destinationId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3768
	    position:destinationPoint
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3769
	    rootPosition:rootPoint
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3770
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3771
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3772
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3773
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3774
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3775
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3776
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3777
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3778
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3779
!XWorkstation methodsFor:'drag & drop - xdnd'!
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3780
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3781
initializeXdnd
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3782
    "Xdnd is an alternative protocol for drag and drop
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3783
     (both modern and standard now)"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3784
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3785
     |xDndAware xDndSelection xDndEnter xDndLeave xDndPosition
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3786
      xDndDrop xDndFinished xDndStatus xDndActionCopy xDndActionMove
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3787
      xDndActionLink xDndActionAsk xDndActionPrivate xDndTypeList xDndTextUriList
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3788
      xDndSelectionAtom|
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3789
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3790
     xDndAware := self atomIDOf:#XdndAware create:false.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3791
     xDndAware notNil ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3792
	 xDndSelection := self atomIDOf:#XdndSelection create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3793
	 xDndEnter := self atomIDOf:#XdndEnter create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3794
	 xDndLeave := self atomIDOf:#XdndLeave create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3795
	 xDndPosition := self atomIDOf:#XdndPosition create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3796
	 xDndDrop := self atomIDOf:#XdndDrop create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3797
	 xDndFinished := self atomIDOf:#XdndFinished create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3798
	 xDndStatus := self atomIDOf:#XdndStatus create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3799
	 xDndActionCopy := self atomIDOf:#XdndActionCopy create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3800
	 xDndActionMove := self atomIDOf:#XdndActionMove create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3801
	 xDndActionLink := self atomIDOf:#XdndActionLink create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3802
	 xDndActionAsk := self atomIDOf:#XdndActionAsk create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3803
	 xDndActionPrivate := self atomIDOf:#XdndActionPrivate create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3804
	 xDndTypeList := self atomIDOf:#XdndTypeList create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3805
	 xDndTextUriList := self atomIDOf:'test/uri-list' create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3806
	 xDndSelectionAtom := self atomIDOf:'XdndSTXSelection' create:true.
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3807
    ].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3808
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3809
    "
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3810
     Display initializeXdnd
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3811
    "
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3812
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3813
    "Created: / 30-10-2018 / 20:56:36 / Claus Gittinger"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3814
!
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3815
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3816
setXdndAwarePropertyFor:aWindowOrWindowID
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3817
    "announce that this window supports the Xdnd (drag & drop) protocol"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3818
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3819
    |xdndAwareAtom|
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3820
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3821
    xdndAwareAtom := self atomIDOf:#XdndAware create:false.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3822
    xdndAwareAtom isNil ifTrue:[
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3823
        "/ mh - window manager is not DND capable
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3824
        Logger info:'display does not support Xdnd'.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3825
        ^ self.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3826
    ].
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3827
    
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3828
    "/ protocol version 3 is from 1998...
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3829
    "/ protocol version 4 from 1999 added root-window drop support...
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3830
    "/ protocol version 5 from 2002 added some info to XdndFinished...
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3831
    self
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3832
        setProperty:xdndAwareAtom
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3833
        type:#ATOM
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3834
        value:3
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3835
        for:aWindowOrWindowID
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  3836
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3837
    "
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3838
     Display setXdndAwarePropertyFor:Transcript
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3839
     Display getProperty:#'XdndAware' from:Transcript delete:false
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3840
    "
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3841
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3842
    "Created: / 30-10-2018 / 12:59:27 / Claus Gittinger"
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3843
    "Modified (format): / 22-06-2019 / 15:08:46 / Claus Gittinger"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3844
!
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3845
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3846
xdndMessage:event data:data view:targetView
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3847
    "handle a xdnd drag&drop protocol message.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3848
     Ignored for now"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3849
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3850
    Logger info:'xdnd: %1 - %2 - %3' with:event with:data with:targetView.
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3851
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3852
    "Created: / 30-10-2018 / 21:06:49 / Claus Gittinger"
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  3853
    "Modified (comment): / 22-06-2019 / 15:08:33 / Claus Gittinger"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3854
! !
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  3855
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3856
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3857
8655
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3858
_displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3859
    "draw a line. If the coordinates are not integers, an error is triggered."
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3860
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3861
    <context: #return>
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3862
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3863
    operationsUntilFlush notNil ifTrue:[
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3864
	operationsUntilFlush <= 0 ifTrue:[
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3865
	    self flush.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3866
	] ifFalse:[
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3867
	    operationsUntilFlush := operationsUntilFlush - 1.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3868
	].
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3869
    ].
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3870
%{
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3871
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3872
    GC gc;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3873
    Window win;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3874
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3875
    if (ISCONNECTED
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3876
     && __isExternalAddress(aGCId)
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3877
     && __isExternalAddress(aDrawableId)
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3878
     && __bothSmallInteger(x0, y0)
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3879
     && __bothSmallInteger(x1, y1)) {
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3880
	Display *dpy = myDpy;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3881
	int ix0, iy0, ix1, iy1;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3882
	gc = __GCVal(aGCId);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3883
	win = __WindowVal(aDrawableId);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3884
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3885
	ix0 = __intVal(x0);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3886
	iy0 = __intVal(y0);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3887
	ix1 = __intVal(x1);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3888
	iy1 = __intVal(y1);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3889
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3890
	/* attention: coordinates in X are shorts and wrap; clamp here. */
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3891
	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3892
	else if (ix0 < -0x8000) ix0 = -0x8000;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3893
	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3894
	else if (iy0 < -0x8000) iy0 = -0x8000;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3895
	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3896
	else if (ix1 < -0x8000) ix1 = -0x8000;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3897
	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3898
	else if (iy1 < -0x8000) iy1 = -0x8000;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3899
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3900
	ENTER_XLIB();
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3901
	if ((ix0 == ix1) && (iy0 == iy1)) {
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3902
	    /* little bit shorter X-lib message (better with slow connections...) */
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3903
	    XDrawPoint(dpy, win, gc, ix0, iy0);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3904
	} else {
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3905
	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3906
	}
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3907
	LEAVE_XLIB();
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3908
	RETURN ( self );
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3909
    }
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3910
%}.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3911
    "badGC, badDrawable or coordinates not integer"
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3912
    self primitiveFailedOrClosedConnection
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3913
!
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3914
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3915
_fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3916
    "fill a rectangle.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3917
     If any coordinate is not integer, an error is triggered."
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3918
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3919
    <context: #return>
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3920
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3921
    operationsUntilFlush notNil ifTrue:[
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3922
	operationsUntilFlush <= 0 ifTrue:[
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3923
	    self flush.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3924
	] ifFalse:[
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3925
	    operationsUntilFlush := operationsUntilFlush - 1.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3926
	].
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3927
    ].
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3928
%{
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3929
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3930
    int w, h;
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3931
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3932
    if (ISCONNECTED
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3933
     && __isExternalAddress(aGCId)
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3934
     && __isExternalAddress(aDrawableId)
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3935
     && __bothSmallInteger(x, y)
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3936
     && __bothSmallInteger(width, height)) {
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3937
	w = __intVal(width);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3938
	h = __intVal(height);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3939
	/*
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3940
	 * need this check here: some servers simply dump core with bad args
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3941
	 */
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3942
	if ((w >= 0) && (h >= 0)) {
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3943
	    ENTER_XLIB();
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3944
	    XFillRectangle(myDpy,
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3945
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3946
			   __intVal(x), __intVal(y), w, h);
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3947
	    LEAVE_XLIB();
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3948
	}
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3949
	RETURN ( self );
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3950
    }
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3951
%}.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3952
    "badGC, badDrawable or coordinates not integer"
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3953
    self primitiveFailedOrClosedConnection
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3954
!
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  3955
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3956
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
  3957
    "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
  3958
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3959
    <context: #return>
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3960
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3961
    operationsUntilFlush notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3962
	operationsUntilFlush <= 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3963
	    self flush.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3964
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3965
	    operationsUntilFlush := operationsUntilFlush - 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3966
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3967
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3968
%{
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3969
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3970
    int w, h;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3971
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3972
    if (ISCONNECTED
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3973
     && __isExternalAddress(aDrawableId)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3974
     && __bothSmallInteger(x, y)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3975
     && __bothSmallInteger(width, height)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3976
	w = __intVal(width);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3977
	h = __intVal(height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3978
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3979
	 * 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
  3980
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3981
	if ((w >= 0) && (h >= 0)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3982
	    ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3983
	    XClearArea(myDpy,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3984
			   __DrawableVal(aDrawableId),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3985
			   __intVal(x), __intVal(y), w, h, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3986
	    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3987
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3988
	RETURN ( self );
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3989
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3990
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3991
    "badGC, badDrawable or coordinates not integer"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3992
    self primitiveFailedOrClosedConnection
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3993
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3994
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3995
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
  3996
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3997
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3998
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3999
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4000
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4001
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4002
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4003
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4004
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4005
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4006
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4007
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4008
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4009
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4010
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4011
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4012
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4013
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4014
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4015
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4016
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4017
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4018
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4019
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4020
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4021
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4022
	int _sX, _sY, _w, _h, _dX, _dY;
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
	_sX = __intVal(srcX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4025
	_sY = __intVal(srcY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4026
	_w = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4027
	_h = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4028
	_dX = __intVal(dstX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4029
	_dY = __intVal(dstY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4030
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4031
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4032
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4033
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4034
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4035
	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4036
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4037
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4038
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4039
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4040
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4041
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4042
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4043
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4044
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4045
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4046
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
  4047
    "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
  4048
     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
  4049
     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
  4050
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4051
     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
  4052
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4053
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4054
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4055
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4056
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4057
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4058
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4059
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4060
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4061
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4062
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4063
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4064
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4065
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4066
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4067
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4068
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4069
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4070
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4071
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4072
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4073
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4074
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4075
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4076
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4077
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4078
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4079
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4080
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4081
	XCopyArea(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4082
				__intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4083
				__intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4084
				__intVal(dstX), __intVal(dstY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4085
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4086
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4087
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4088
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4089
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4090
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4091
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4092
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4093
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4094
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4095
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  4096
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
  4097
    "do a bit-blt, but only copy the low-bit plane;
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4098
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4099
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4100
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4101
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4102
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4103
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4104
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4105
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4106
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4107
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4108
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4109
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4110
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4111
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4112
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4113
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4114
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4115
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4116
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4117
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4118
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4119
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4120
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4121
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4122
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4123
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4124
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4125
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4126
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4127
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4128
	XCopyPlane(myDpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4129
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4130
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4131
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4132
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4133
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4134
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4135
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4136
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4137
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4138
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4139
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4140
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4141
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4142
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
  4143
    "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
  4144
     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
  4145
     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
  4146
     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
  4147
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4148
     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
  4149
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4150
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4151
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4152
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4153
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4154
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4155
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4156
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4157
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4158
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4159
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4160
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4161
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4162
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4163
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4164
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4165
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4166
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4167
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4168
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4169
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4170
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4171
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4172
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4173
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4174
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4175
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4176
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4177
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4178
	XCopyPlane(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4179
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4180
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4181
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4182
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4183
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4184
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4185
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4186
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4187
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4188
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4189
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4190
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4191
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  4192
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  4193
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
  4194
    "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
  4195
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4196
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4197
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4198
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4199
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4200
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4201
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4202
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4203
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4204
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4205
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4206
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4207
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4208
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4209
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4210
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4211
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4212
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4213
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4214
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4215
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4216
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4217
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4218
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4219
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4220
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4221
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4222
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4223
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4224
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4225
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4226
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4227
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4228
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4229
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4230
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4231
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4232
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4233
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4234
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4235
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4236
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4237
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4238
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4239
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4240
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4241
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4242
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4243
	 * 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
  4244
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4245
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4246
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4247
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4248
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4249
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4250
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4251
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4252
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4253
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4254
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4255
    "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
  4256
     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
  4257
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4258
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4259
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4260
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4261
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
  4262
    "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
  4263
8644
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4264
%{  /* NOCONTEXT */
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4265
    if (__INST(operationsUntilFlush) == nil) {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4266
	GC gc;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4267
	Window win;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4268
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4269
	if (ISCONNECTED
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4270
	 && __isExternalAddress(aGCId)
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4271
	 && __isExternalAddress(aDrawableId)
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4272
	 && __bothSmallInteger(x0, y0)
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4273
	 && __bothSmallInteger(x1, y1)) {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4274
	    Display *dpy = myDpy;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4275
	    int ix0, iy0, ix1, iy1;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4276
	    gc = __GCVal(aGCId);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4277
	    win = __WindowVal(aDrawableId);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4278
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4279
	    ix0 = __intVal(x0);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4280
	    iy0 = __intVal(y0);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4281
	    ix1 = __intVal(x1);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4282
	    iy1 = __intVal(y1);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4283
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4284
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4285
	    if (ix0 > 0x7FFF) ix0 = 0x7FFF;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4286
	    else if (ix0 < -0x8000) ix0 = -0x8000;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4287
	    if (iy0 > 0x7FFF) iy0 = 0x7FFF;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4288
	    else if (iy0 < -0x8000) iy0 = -0x8000;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4289
	    if (ix1 > 0x7FFF) ix1 = 0x7FFF;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4290
	    else if (ix1 < -0x8000) ix1 = -0x8000;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4291
	    if (iy1 > 0x7FFF) iy1 = 0x7FFF;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4292
	    else if (iy1 < -0x8000) iy1 = -0x8000;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4293
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4294
	    ENTER_XLIB();
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4295
	    if ((ix0 == ix1) && (iy0 == iy1)) {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4296
		/* little bit shorter X-lib message (better with slow connections...) */
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4297
		XDrawPoint(dpy, win, gc, ix0, iy0);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4298
	    } else {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4299
		XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4300
	    }
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4301
	    LEAVE_XLIB();
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4302
	    RETURN ( self );
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4303
	}
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4304
    }
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4305
%}.
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4306
    self _displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4307
!
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  4308
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4309
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
  4310
    "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
  4311
     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
  4312
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4313
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4314
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4315
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4316
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4317
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4318
    (noY := yValues size) < 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4319
	^ self
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4320
    ].
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4321
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4322
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4323
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4324
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4325
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4326
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4327
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4328
    ].
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4329
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4330
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4331
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4332
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4333
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4334
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4335
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4336
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4337
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4338
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4339
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4340
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4341
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4342
     && __isExternalAddress(aDrawableId) ) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4343
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4344
	win = __WindowVal(aDrawableId);
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
	if( __isSmallInteger(scaleY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4347
	    sY = (float) __intVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4348
	else if (__isFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4349
	    sY = __floatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4350
	else if (__isShortFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4351
	    sY = __shortFloatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4352
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4353
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4354
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4355
	    sY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4356
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4357
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4358
	if( __isSmallInteger(transY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4359
	    tY = (float) __intVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4360
	else if (__isFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4361
	    tY = __floatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4362
	else if (__isShortFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4363
	    tY = __shortFloatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4364
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4365
	    t = __SSEND0(transY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4366
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4367
	    tY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4368
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4369
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4370
	if( __isSmallInteger(startX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4371
	    x = (float) __intVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4372
	else if (__isFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4373
	    x = __floatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4374
	else if (__isShortFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4375
	    x = __shortFloatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4376
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4377
	    t = __SSEND0(startX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4378
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4379
	    x = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4380
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4381
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4382
	if( __isSmallInteger(stepX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4383
	    step = (float) __intVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4384
	else if (__isFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4385
	    step = __floatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4386
	else if (__isShortFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4387
	    step = __shortFloatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4388
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4389
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4390
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4391
	    step = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4392
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4393
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4394
	num = __intVal( noY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4395
	if( num > 200 ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4396
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4397
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4398
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4399
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4400
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4401
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4402
	for( i = 0; i < num; ++i ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4403
	    int px, py;
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
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4406
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4407
	    if( __isFloat(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4408
		y = __floatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4409
	    else if( __isSmallInteger(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4410
		y = (float) __intVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4411
	    else if( __isShortFloat( yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4412
		y = __shortFloatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4413
	    else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4414
		t = __SSEND0(yA, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4415
		if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4416
		y = __floatVal( t );
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4419
	    px = (int) (x + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4420
	    py = (int) ((y * sY) + tY + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4421
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4422
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4423
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4424
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4425
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4426
	    else if (py < -0x8000) py = -0x8000;
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
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4429
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4430
	    x = x + step;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4431
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4432
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4433
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4434
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4435
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4436
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4437
	if( mustFree ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4438
	    free( points );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4439
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4440
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4441
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4442
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4443
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4444
    if( mustFree )
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4445
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4446
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4447
    ^ 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
  4448
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  4449
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4450
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4451
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4452
displayPointX:x y:y in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4453
    "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
  4454
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4455
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4456
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4457
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4458
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4459
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4460
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4461
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4462
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4463
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4464
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4465
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4466
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4467
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4468
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4469
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4470
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4471
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4472
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4473
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4474
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4475
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4476
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4477
	px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4478
	py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4479
	if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4480
	else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4481
	if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4482
	else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4483
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4484
	XDrawPoint(myDpy, win, gc, px, py);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4485
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4486
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4487
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4488
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4489
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4490
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4491
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4492
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4493
displayPointsX:xColl y:yColl in:aDrawableId with:aGCId
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4494
    "draw a collection of points. Each element of xColl/yCollmust be integer,
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4495
     otherwise, an error is triggered."
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4496
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4497
    <context: #return>
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4498
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4499
    |n|
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4500
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4501
    xColl isArray ifFalse:[self error].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4502
    yColl isArray ifFalse:[self error].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4503
    (n := xColl size) == yColl size ifFalse:[self error].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4504
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4505
    operationsUntilFlush notNil ifTrue:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4506
	operationsUntilFlush <= 0 ifTrue:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4507
	    self flush.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4508
	] ifFalse:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4509
	    operationsUntilFlush := operationsUntilFlush - 1.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4510
	].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4511
    ].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4512
%{
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4513
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4514
    GC gc;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4515
    Window win;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4516
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4517
    if (ISCONNECTED
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4518
     && __isExternalAddress(aGCId)
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4519
     && __isExternalAddress(aDrawableId)) {
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4520
	int _n = __intVal(n);
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4521
	int i;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4522
	gc = __GCVal(aGCId);
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4523
	win = __WindowVal(aDrawableId);
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4524
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4525
	ENTER_XLIB();
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4526
	for (i=0; i<_n; i++) {
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4527
	    int px, py;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4528
	    OBJ x = __ArrayInstPtr(xColl)->a_element[i];
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4529
	    OBJ y = __ArrayInstPtr(yColl)->a_element[i];
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4530
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4531
	    if (!__bothSmallInteger(x,y)) goto fail;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4532
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4533
	    px = __intVal(x);
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4534
	    py = __intVal(y);
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4535
	    if (px > 0x7FFF) px = 0x7FFF;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4536
	    else if (px < -0x8000) px = -0x8000;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4537
	    if (py > 0x7FFF) py = 0x7FFF;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4538
	    else if (py < -0x8000) py = -0x8000;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4539
	    XDrawPoint(myDpy, win, gc, px, py);
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4540
	}
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4541
	LEAVE_XLIB();
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4542
	RETURN ( self );
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4543
    }
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4544
    fail: ;
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4545
%}.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4546
    "badGC, badDrawable or x/y not integer"
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4547
    self primitiveFailedOrClosedConnection
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4548
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4549
    "Created: / 17-01-2019 / 10:50:32 / Claus Gittinger"
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4550
!
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
  4551
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4552
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4553
    "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
  4554
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4555
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4556
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4557
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4558
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4559
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4560
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4561
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4562
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4563
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4564
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4565
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4566
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4567
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4568
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4569
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4570
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4571
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4572
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4573
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4574
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4575
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4576
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4577
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4578
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4579
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4580
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4581
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4582
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4583
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4584
	num = __intVal(numberOfPoints);
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
	 * avoid a (slow) malloc, if the number of points is small
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4587
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4588
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4589
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4590
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4591
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4592
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4593
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4594
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4595
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4596
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4597
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4598
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4599
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4600
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4601
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4602
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4603
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4604
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4605
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4606
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4607
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4608
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4609
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4610
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4611
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4612
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4613
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4614
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4615
	    points[i].y = py;
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
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
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4620
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4621
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4622
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4623
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4624
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4625
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4626
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4627
    if (mustFree)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4628
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4629
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4630
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4631
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4632
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4633
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4634
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
  4635
    "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
  4636
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4637
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4638
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4639
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4640
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4641
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4642
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4643
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4644
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4645
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4646
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4647
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4648
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4649
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4650
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4651
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4652
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4653
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4654
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4655
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4656
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4657
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4658
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4659
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4660
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4661
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4662
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4663
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4664
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4665
	 * 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
  4666
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4667
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4668
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4669
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4670
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4671
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4672
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4673
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4674
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4675
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4676
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4677
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4678
	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4679
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4680
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4681
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4682
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4683
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4684
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4685
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4686
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4687
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4688
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
  4689
    "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
  4690
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4691
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4692
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4693
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4694
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4695
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4696
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4697
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4698
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4699
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4700
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4701
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4702
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4703
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4704
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4705
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4706
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4707
    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
  4708
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4709
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4710
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4711
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4712
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4713
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4714
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4715
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4716
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4717
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4718
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4719
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4720
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4721
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4722
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4723
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4724
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4725
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4726
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4727
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4728
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4729
		RETURN (self);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4730
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4731
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4732
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4733
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4734
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4735
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4736
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4737
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4738
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4739
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4740
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4741
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4742
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4743
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4744
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4745
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4746
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4747
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4748
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4749
	    cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4750
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4751
	    cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4752
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4753
	    if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4754
		n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4755
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4756
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4757
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4758
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4759
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4760
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4761
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4762
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4763
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4764
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4765
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4766
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4767
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4768
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4769
	    /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4770
	    if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4771
		n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4772
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4773
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4774
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4775
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4776
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4777
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4778
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4779
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4780
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4781
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4782
		    if (l > lMax) l = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4783
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4784
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4785
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4786
		     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4787
		     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4788
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4789
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4790
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4791
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4792
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4793
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4794
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4795
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4796
		    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4797
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4798
		    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4799
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4800
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4801
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4802
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4803
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4804
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4805
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4806
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4807
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4808
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4809
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4810
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4811
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4812
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4813
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4814
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4815
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4816
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4817
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4818
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4819
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4820
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4821
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4822
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4823
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4824
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4825
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4826
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4827
	    /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4828
	    if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4829
		n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4830
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4831
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4832
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4833
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4834
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4835
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4836
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4837
		    int32 *ip;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4838
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4839
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4840
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4841
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4842
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4843
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4844
		     * 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
  4845
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4846
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4847
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4848
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4849
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4850
			mustFree = 1;
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
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4853
			int32 codePoint = ((int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4854
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4855
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4856
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4857
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4858
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4859
			cp2[i].byte2 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4860
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4861
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4862
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4863
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4864
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4865
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4866
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4867
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4868
		    LEAVE_XLIB();
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
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4871
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4872
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4873
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4874
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4875
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4876
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4877
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4878
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4879
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4880
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4881
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4882
	self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4883
	     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
  4884
	^ self.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4885
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4886
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4887
    "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
  4888
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4889
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4890
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4891
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
  4892
    "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
  4893
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4894
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4895
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4896
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4897
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4898
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4899
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4900
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4901
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4902
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4903
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4904
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4905
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4906
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4907
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4908
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4909
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4910
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4911
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4912
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4913
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4914
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4915
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4916
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4917
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4918
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4919
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4920
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4921
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4922
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4923
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4924
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4925
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4926
	cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4927
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4928
	if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4929
	    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4930
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4931
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4932
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4933
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4934
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4935
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4936
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4937
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4938
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4939
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4940
	cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4941
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4942
	cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4943
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4944
	if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4945
	    n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4946
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4947
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4948
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4949
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4950
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4951
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4952
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4953
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4954
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4955
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4956
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4957
	/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4958
	if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4959
	    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4960
		char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4961
		unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4962
	    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4963
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4964
	    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4965
	    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4966
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4967
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4968
	    if (n > lMax) n = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4969
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4970
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4971
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4972
	     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4973
	     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4974
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4975
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
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
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4978
	     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4979
	     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4980
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4981
	    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4982
	    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4983
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4984
	    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4985
		if (n <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4986
		    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4987
		} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4988
		    cp2 = (XChar2b *)(malloc(n * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4989
		    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4990
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4991
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4992
		for (i=0; i<n; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4993
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4994
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4995
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4996
		cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4997
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4998
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4999
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5000
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5001
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5002
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5003
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5004
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5005
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5006
	    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5007
		free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5008
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5009
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5010
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5011
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5012
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  5013
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5014
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5015
    ^ 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
  5016
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5017
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5018
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5019
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5020
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5021
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5022
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5023
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5024
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5025
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5026
    "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
  5027
     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
  5028
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5029
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5030
     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
  5031
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5032
     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
  5033
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5034
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5035
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5036
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5037
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5038
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5039
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5040
    "/ 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
  5041
    "/ 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
  5042
    "/ 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
  5043
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5044
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  5045
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5046
	fmt := self supportedImageFormatForDepth:4.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5047
	fmt isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5048
	    self primitiveFailed. "/ cannot represent this image
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5049
	    ^ nil
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5050
	].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5051
	wantedPadding := fmt at:#padding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5052
	wantedPadding > givenPadding ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5053
	    bits := self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5054
			    repadBits:givenBits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5055
			    width:imageWidth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5056
			    height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5057
			    depth:imageDepth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5058
			    from:givenPadding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5059
			    to:wantedPadding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5060
	    padding := wantedPadding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5061
	]
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5062
    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5063
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5064
    self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5065
	drawBits:bits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5066
	msb:true bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5067
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5068
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5069
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5070
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5071
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5072
	with:aGCId
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5073
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5074
    "Modified: / 11-04-2017 / 18:50:32 / cg"
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5075
!
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5076
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5077
drawBits:bits msb:msb bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5078
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5079
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5080
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5081
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5082
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5083
	with:aGCId
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5084
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5085
    "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
  5086
     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
  5087
     Individual source pixels have bitsPerPixel bits, allowing to draw
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5088
     depth and pixel-units to be different.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5089
     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
  5090
     depth - otherwise, primitive failure will be signalled.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5091
     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
  5092
     colors are allocated - otherwise the colors may be wrong."
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  5093
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  5094
    operationsUntilFlush notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5095
	operationsUntilFlush <= 0 ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5096
	    self flush.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5097
	] ifFalse:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5098
	    operationsUntilFlush := operationsUntilFlush - 1.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5099
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  5100
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5101
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5102
     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
  5103
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5104
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5105
    (self
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5106
	primDrawBits:bits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5107
	bitsPerPixel:bitsPerPixel
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5108
	depth:imageDepth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5109
	msb:msb
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5110
	padding:padding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5111
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5112
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5113
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5114
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5115
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5116
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5117
    ifFalse:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5118
	"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5119
	 also happens, if a segmentation violation occurs in the
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5120
	 XPutImage ...
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5121
	"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5122
	self primitiveFailedOrClosedConnection
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5123
    ].
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5124
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  5125
    "Created: / 11-04-2017 / 18:49:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5126
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5127
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  5128
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
  5129
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  5130
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  5131
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5132
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5133
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  5134
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  5135
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5136
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5137
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5138
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5139
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5140
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  5141
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5142
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5143
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5144
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5145
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5146
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5147
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5148
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5149
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5150
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  5151
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5152
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5153
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  5154
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5155
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5156
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5157
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5158
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5159
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5160
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  5161
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5162
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5163
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  5164
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5165
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5166
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5167
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5168
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5169
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5170
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5171
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5172
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5173
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5174
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5175
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5176
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5177
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5178
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5179
	 * 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
  5180
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5181
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5182
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5183
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5184
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5185
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5186
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5187
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5188
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5189
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5190
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5191
    "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
  5192
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5193
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5194
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5195
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  5196
48194c26a46c Initial revision
claus
parents:
diff changeset
  5197
fillPolygon:aPolygon in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5198
    "fill a polygon given by its points.
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  5199
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5200
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5201
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5202
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5203
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5204
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  5205
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5206
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5207
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5208
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5209
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5210
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  5211
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5212
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  5213
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5214
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5215
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5216
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5217
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5218
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5219
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  5220
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5221
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5222
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5223
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5224
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5225
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5226
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5227
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5228
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5229
	if (num < 3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5230
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5231
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5232
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5233
	 * avoid (slow) malloc, if not many points
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5234
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5235
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5236
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5237
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5238
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5239
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5240
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5241
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5242
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5243
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5244
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5245
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5246
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5247
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5248
	    points[i].x = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5249
	    points[i].y = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5250
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5251
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5252
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5253
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5254
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5255
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5256
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  5257
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5258
fail: ;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5259
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5260
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5261
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5262
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  5263
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5264
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5265
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  5266
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5267
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
8644
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5268
    "fill a rectangle.
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5269
     If any coordinate is not integer, an error is triggered."
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5270
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5271
%{  /* NOCONTEXT */
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5272
    if (__INST(operationsUntilFlush) == nil) {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5273
	int w, h;
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5274
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5275
	if (ISCONNECTED
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5276
	 && __isExternalAddress(aGCId)
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5277
	 && __isExternalAddress(aDrawableId)
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5278
	 && __bothSmallInteger(x, y)
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5279
	 && __bothSmallInteger(width, height)) {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5280
	    w = __intVal(width);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5281
	    h = __intVal(height);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5282
	    /*
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5283
	     * need this check here: some servers simply dump core with bad args
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5284
	     */
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5285
	    if ((w >= 0) && (h >= 0)) {
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5286
		ENTER_XLIB();
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5287
		XFillRectangle(myDpy,
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5288
			       __DrawableVal(aDrawableId), __GCVal(aGCId),
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5289
			       __intVal(x), __intVal(y), w, h);
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5290
		LEAVE_XLIB();
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5291
	    }
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5292
	    RETURN ( self );
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5293
	}
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5294
    }
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5295
%}.
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5296
    self _fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5297
!
88aa821a64ec slight tuning
Claus Gittinger <cg@exept.de>
parents: 8613
diff changeset
  5298
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5299
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5300
    msb:msb masks:maskArray padding:bitPadding
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5301
    extent:imageExtent sourceOrigin:srcOrg
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5302
    into:aDrawableId
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5303
    destinationOrigin:dstOrg extent:dstExtent
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5304
    with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5305
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5306
    <context: #return>
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5307
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5308
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5309
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5310
    imageWidth := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5311
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5312
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5313
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5314
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5315
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5316
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5317
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5318
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5319
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5320
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5321
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5322
    "since XPutImage may allocate huge amount of stack space
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5323
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5324
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5325
%{  /* UNLIMITEDSTACK */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5326
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5327
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5328
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5329
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5330
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5331
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5332
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5333
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5334
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5335
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5336
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5337
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5338
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5339
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5340
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5341
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5342
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5343
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5344
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5345
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5346
     && __isSmallInteger(bm)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5347
     && __isByteArrayLike(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5348
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5349
	int pad = __intVal(bitPadding);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5350
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5351
	gc = __GCVal(aGCId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5352
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5353
	if (! gc || !win)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5354
	    goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5355
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5356
	console_printf("args ok\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5357
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5358
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5359
	image.width = imgWdth = __intVal(imageWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5360
	image.height = __intVal(imageHeight);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5361
	image.xoffset = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5362
	image.format = ZPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5363
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5364
	image.bitmap_unit = 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5365
	image.bitmap_bit_order = MSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5366
	image.bitmap_pad = pad;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5367
	image.depth = __intVal(imageDepth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5368
	image.bits_per_pixel = __intVal(bitsPerPixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5369
	image.red_mask = __intVal(rm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5370
	image.green_mask = __intVal(gm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5371
	image.blue_mask = __intVal(bm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5372
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5373
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5374
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5375
	switch (image.bits_per_pixel) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5376
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5377
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5378
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5379
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5380
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5381
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5382
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5383
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5384
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5385
	    default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5386
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5387
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5388
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5389
		goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5390
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5391
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5392
	/* ENTER_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5393
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5394
					__intVal(dstx), __intVal(dsty),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5395
					__intVal(w), __intVal(h));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5396
	/* LEAVE_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5397
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5398
	RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5399
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5400
#ifdef ARGDEBUG
8061
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5401
    if (! __isExternalAddress(aGCId)) console_printf("GC\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5402
    if (! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5403
    if (! __isSmallInteger(srcx)) console_printf("srcx\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5404
    if (! __isSmallInteger(srcy)) console_printf("srcy\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5405
    if (! __isSmallInteger(dstx)) console_printf("dstx\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5406
    if (! __isSmallInteger(dsty)) console_printf("dsty\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5407
    if (! __isSmallInteger(w)) console_printf("w\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5408
    if (! __isSmallInteger(h)) console_printf("h\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5409
    if (! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5410
    if (! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5411
    if (! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5412
    if (! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5413
    if (! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5414
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5415
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5416
fail: ;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5417
%}
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5418
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5419
    ^ false
8061
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5420
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5421
    "Modified: / 08-08-2017 / 14:16:05 / cg"
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5422
!
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5423
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5424
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5425
    msb:msb padding:bitPadding
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5426
    width:imageWidth height:imageHeight
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5427
    x:srcx y:srcy
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5428
    into:aDrawableId
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5429
    x:dstx y:dsty
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5430
    width:w height:h
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5431
    with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5432
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5433
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5434
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5435
    "since XPutImage may allocate huge amount of stack space
132
claus
parents: 129
diff changeset
  5436
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  5437
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5438
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5439
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5440
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5441
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5442
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5443
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5444
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5445
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5446
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  5447
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5448
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5449
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5450
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5451
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5452
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5453
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5454
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5455
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5456
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  5457
     && __isSmallInteger(bitPadding)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5458
     && __isByteArrayLike(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5459
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5460
	int pad = __intVal(bitPadding);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5461
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5462
	gc = __GCVal(aGCId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5463
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5464
	if (! gc || !win)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5465
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5466
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5467
	console_printf("args ok\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5468
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5469
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5470
	image.width = imgWdth = __intVal(imageWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5471
	image.height = __intVal(imageHeight);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5472
	image.xoffset = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5473
	image.format = ZPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5474
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5475
	image.bitmap_unit = 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5476
	image.bitmap_bit_order = MSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5477
	image.bitmap_pad = pad;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5478
	image.depth = __intVal(imageDepth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5479
	image.bits_per_pixel = __intVal(bitsPerPixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5480
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5481
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5482
	image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5483
	*/
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5484
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5485
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5486
	switch (image.bits_per_pixel) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5487
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5488
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5489
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5490
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5491
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5492
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5493
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5494
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5495
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5496
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5497
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5498
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5499
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5500
		goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5501
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5502
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5503
	image.red_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5504
	image.green_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5505
	image.blue_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5506
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5507
	/* ENTER_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5508
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5509
					__intVal(dstx), __intVal(dsty),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5510
					__intVal(w), __intVal(h));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5511
	/* LEAVE_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5512
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5513
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5514
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5515
#ifdef ARGDEBUG
8062
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5516
    if (! __isExternalAddress(aGCId)) console_printf("GC\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5517
    if (! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5518
    if (! __isSmallInteger(srcx)) console_printf("srcx\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5519
    if (! __isSmallInteger(srcy)) console_printf("srcy\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5520
    if (! __isSmallInteger(dstx)) console_printf("dstx\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5521
    if (! __isSmallInteger(dsty)) console_printf("dsty\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5522
    if (! __isSmallInteger(w)) console_printf("w\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5523
    if (! __isSmallInteger(h)) console_printf("h\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5524
    if (! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5525
    if (! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5526
    if (! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5527
    if (! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5528
    if (! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5529
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5530
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5531
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5532
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  5533
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5534
    ^ false
8062
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5535
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5536
    "Modified: / 08-08-2017 / 14:16:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5537
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  5538
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5539
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5540
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5541
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
  5542
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5543
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5544
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5545
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5546
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5547
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5548
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
  5549
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5550
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5551
    |logicalButton clickPosition|
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
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5554
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5555
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5556
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5557
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5558
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5559
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5560
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5561
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5562
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5563
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  5564
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  5565
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  5566
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5567
      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
  5568
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5569
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5570
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5571
    logicalButton isInteger ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5572
	buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5573
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5574
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5575
    clickPosition := x @ y.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5576
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5577
    (multiClickTimeDelta notNil
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5578
     and:[lastButtonPressTime notNil
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5579
     and:[time < (lastButtonPressTime + multiClickTimeDelta)
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5580
     and:[(clickPosition dist:lastButtonPressPosition) < 6]]]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5581
	lastButtonPressTime := time.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5582
	lastButtonPressPosition := clickPosition.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5583
	self buttonMultiPress:logicalButton x:x y:y view:view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5584
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5585
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5586
    lastButtonPressTime := time.
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5587
    lastButtonPressPosition := clickPosition.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5588
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5589
    view isNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5590
	"/ event arrived, after I destroyed it myself
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5591
	^ self
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5592
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5593
    (logicalButton == 1 and:[activateOnClick == true]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5594
	"/ don't raise above an active popup view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5595
	(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5596
	    view topView raise.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5597
	]
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5598
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5599
    self buttonPress:logicalButton x:x y:y view:view
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5600
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5601
    "Modified: / 09-05-2017 / 10:33:01 / stefan"
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5602
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5603
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5604
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
  5605
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5606
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5607
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5608
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5609
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5610
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5611
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5612
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5613
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5614
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5615
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5616
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5617
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5618
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5619
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5620
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5621
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5622
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5623
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5624
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5625
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5626
    logicalButton isInteger ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5627
	buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5628
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5629
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5630
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5631
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5632
clientMessage:targetView type:typeAtom format:format data:data
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5633
    |sensor xdndAwareAtom dndProtocolAtom|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5634
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5635
    targetView isNil ifTrue:[
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5636
        "targetView is gone? Anyway, cannot do anything with this event..."
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5637
        ^ self.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5638
    ].
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5639
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5640
    (xdndAwareAtom := self atomIDOf:#XdndAware create:false) notNil ifTrue:[
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5641
        "DND drag&drop protocol"
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5642
        (typeAtom == xdndAwareAtom) ifTrue:[
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5643
            self xdndMessage:nil data:data view:targetView.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5644
            ^ self.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5645
        ].
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5646
    ].
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5647
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5648
    (dndProtocolAtom := self atomIDOf:#DndProtocol create:false) notNil ifTrue:[
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5649
        "DND drag&drop protocol"
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5650
        (format == 32 and:[typeAtom == dndProtocolAtom]) ifTrue:[
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5651
            self dndMessage:nil data:data view:targetView.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5652
            ^ self.
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5653
        ].
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5654
    ].
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5655
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5656
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5657
    "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
  5658
    sensor notNil ifTrue:[
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5659
        sensor clientMessage:typeAtom format:format eventData:data view:targetView
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  5660
    ].
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  5661
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
  5662
    "Created: / 04-04-1997 / 17:49:26 / cg"
8706
92fd4a337e50 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8681
diff changeset
  5663
    "Modified: / 22-06-2019 / 15:07:49 / Claus Gittinger"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5664
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5665
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5666
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
  5667
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5668
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5669
"/    anotherViewId notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5670
"/        |parentViewOrSelf|
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5671
"/        parentViewOrSelf := self viewFromId:anotherViewId.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5672
"/        parentViewOrSelf notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5673
"/        ].
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5674
"/     ].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5675
    self configureX:x y:y width:w height:h view:view.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5676
    aboveViewId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5677
	|aboveView|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5678
	aboveView := self viewFromId:aboveViewId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5679
	aboveView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5680
	    "view is now on the top of the window stack"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5681
	    self coveredBy:view view:aboveView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5682
	].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5683
     ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5684
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5685
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5686
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
  5687
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5688
    view isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5689
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5690
	^ self
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5691
    ].
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5692
    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
  5693
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5694
    "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
  5695
    "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
  5696
!
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5697
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5698
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
  5699
    "forward an expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5700
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5701
    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
  5702
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5703
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5704
focusIn:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5705
    "a view got the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5706
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5707
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5708
	"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
  5709
	self focusInView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5710
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5711
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5712
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5713
focusOut:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5714
    "a view lost the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5715
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5716
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5717
	"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
  5718
	self focusOutView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5719
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5720
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5721
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5722
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
  5723
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5724
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5725
    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
  5726
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5727
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5728
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
  5729
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5730
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5731
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5732
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  5733
    "/ 'key: ' print. key print. ' view:' print. view printCR.
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  5734
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5735
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5736
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5737
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5738
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5739
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5740
    key isNil ifTrue:[
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  5741
	"/ happens sometimes on some systems
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  5742
	"/ (alt-graph on sun has no keysym)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  5743
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5744
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5745
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5746
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5747
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5748
    "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
  5749
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5750
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5751
    self keyPress:commonKey x:x y:y view:view.
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  5752
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  5753
    "Modified: / 28-07-2018 / 12:05:02 / Claus Gittinger"
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5754
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5755
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5756
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
  5757
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5758
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5759
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5760
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5761
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5762
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5763
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5764
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5765
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5766
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5767
    key isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5768
	"/ happens sometimes on some systems
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5769
	"/ (alt-graph on sun has no keysym)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5770
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5771
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5772
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5773
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5774
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5775
    "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
  5776
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5777
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5778
    self keyRelease:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5779
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5780
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5781
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5782
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5783
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5784
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5785
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5786
	self refreshKeyboardMapping:eB.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5787
	"Maybe some of our modifiers have been changed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5788
	self initializeModifierMappings.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5789
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5790
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5791
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5792
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5793
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
  5794
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5795
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5796
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5797
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5798
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5799
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5800
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5801
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5802
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5803
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5804
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5805
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5806
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5807
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
  5808
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5809
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5810
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5811
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5812
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5813
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5814
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5815
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5816
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5817
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5818
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5819
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5820
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5821
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
  5822
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5823
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5824
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5825
    |selectionFetcher|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5826
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5827
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5828
    aView isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5829
	"event arrived, after aView has been destroyed"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5830
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5831
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5832
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5833
"/    '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
  5834
"/    aView propertyChange:atom state:aSymbol.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5835
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5836
    "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
  5837
     be interested (for now, only XEmbedSiteView is)"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5838
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5839
    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
  5840
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5841
    aSymbol ~~ #newValue ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5842
	"I am not interested in delete notifications"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5843
	^ self.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5844
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5845
    selectionFetcher := self findSelectionFetcher:aView drawableId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5846
    selectionFetcher notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5847
	selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5848
    ].
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5849
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5850
    "Modified: / 01-06-2011 / 13:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5851
    "Modified: / 26-04-2018 / 11:00:21 / stefan"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5852
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5853
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5854
selectionClear:aView selection:selectionID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5855
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5856
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5857
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5858
    |selectionFetcher|
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5859
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5860
    lastEventTime := time.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5861
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5862
    selectionHandlers notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5863
	selectionHandlers do:[:eachHandler |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5864
	    eachHandler selectionClear:selectionID
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5865
	]
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5866
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5867
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5868
    aView isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5869
	"event arrived, after aView has been destroyed"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5870
	^ self
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5871
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5872
    selectionFetcher := self findSelectionFetcher:aView drawableId.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5873
    selectionFetcher notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5874
	selectionFetcher message:thisContext message.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5875
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5876
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5877
    "Modified: / 26-04-2018 / 11:00:30 / stefan"
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5878
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5879
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5880
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
  5881
    "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
  5882
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5883
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5884
    |selectionFetcher|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5885
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5886
"/    Transcript show:'selectionNotify selID:'.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5887
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5888
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5889
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5890
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5891
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5892
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5893
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5894
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5895
    lastEventTime := time.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5896
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5897
    aView isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5898
	"event arrived, after aView has been destroyed"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5899
	^ self
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5900
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5901
    selectionFetcher := self findSelectionFetcher:aView drawableId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5902
    selectionFetcher notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5903
	selectionFetcher message:thisContext message.
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5904
    ].
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5905
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5906
    "Modified (format): / 14-03-2017 / 16:31:20 / cg"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5907
    "Modified: / 26-04-2018 / 11:00:36 / stefan"
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5908
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5909
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5910
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5911
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5912
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5913
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5914
    |selection property bufferGetSelector responseTargetID selectionTime|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5915
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5916
"/'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5917
"/' Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5918
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5919
    lastEventTime := time.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5920
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5921
    "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
  5922
    selectionID == primaryAtom ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5923
	bufferGetSelector := #getPrimaryBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5924
	selectionTime := primarySelectionTime.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5925
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5926
	bufferGetSelector := #getCopyBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5927
	selectionTime := clipboardSelectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5928
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5929
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5930
    (targetID == (self atomIDOf:#TIMESTAMP)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5931
	"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
  5932
	responseTargetID := self atomIDOf:#INTEGER.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5933
	selection := selectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5934
    ] ifFalse:[(targetID == (self atomIDOf:#TARGETS)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5935
	"the other view wants to know which targets we support"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5936
	responseTargetID := self atomIDOf:#ATOM.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5937
	selection := self supportedTargetAtoms.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5938
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5939
	selection := self selectionBuffer:bufferGetSelector as:targetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5940
	responseTargetID := selection key.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5941
	selection := selection value.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5942
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5943
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5944
"/'Send selection: ' print. selection printCR.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5945
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5946
    property := propertyID.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5947
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5948
    selection isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5949
	"sending property None tells the client,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5950
	 that I could not convert"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5951
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5952
	property := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5953
	responseTargetID := targetID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5954
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5955
	property == 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5956
	    "Support old (obsolete) clients requesting a None property.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5957
	     Set the propertyID to the targetID"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5958
	    property := responseTargetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5959
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5960
	self setProperty:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5961
	     type:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5962
	     value:selection
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5963
	     for:requestorID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5964
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5965
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5966
    self sendNotifySelection:selectionID
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5967
	 property:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5968
	 target:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5969
	 time:time
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5970
	 to:requestorID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5971
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5972
    "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
  5973
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5974
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5975
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5976
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5977
    aView notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5978
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5979
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5980
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5981
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  5982
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5983
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5984
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5985
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5986
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5987
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5988
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5989
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5990
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5991
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5992
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5993
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5994
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5995
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5996
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5997
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5998
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5999
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6000
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6001
	^ self
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6002
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6003
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6004
    "/ aView colorMapChange
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6005
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6006
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6007
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
  6008
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6009
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6010
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6011
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6012
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6013
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6014
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6015
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6016
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6017
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6018
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6019
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6020
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6021
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6022
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6023
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6024
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6025
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6026
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6027
    "/ aView mapRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6028
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6029
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6030
reparentedView:aView parentId:parentId x:x y:y
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6031
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6032
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6033
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6034
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6035
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6036
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6037
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6038
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  6039
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  6040
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  6041
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  6042
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  6043
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6044
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6045
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6046
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6047
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6048
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6049
			 KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6050
			 PointerMotionMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6051
			 EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6052
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6053
			 PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6054
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6055
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  6056
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6057
dispatchEvent:evArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6058
    "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
  6059
     to a message send here.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6060
     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
  6061
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  6062
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6063
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6064
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6065
    viewId notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6066
	viewId = lastId ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6067
	    view := lastView
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6068
	] ifFalse:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6069
	    view := self viewFromId:viewId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6070
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6071
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6072
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6073
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6074
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6075
    (self respondsTo:evType) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6076
	arguments := evArray copyFrom:3 to:(3 + evType argumentCount - 1).
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6077
	arguments at:1 put:view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6078
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6079
	self perform:evType withArguments:arguments.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  6080
	^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6081
    ].
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6082
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6083
    '********** unhandled event:' errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6084
    evType errorPrintCR. (evArray at:2) errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6085
    '********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6086
    ^ false
7959
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  6087
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  6088
    "Modified: / 23-02-2017 / 19:57:57 / mawalch"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6089
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6090
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6091
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6092
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6093
     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
  6094
     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
  6095
     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
  6096
     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
  6097
     handled.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6098
     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
  6099
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6100
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6101
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6102
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6103
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6104
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6105
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6106
	AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6107
	    ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6108
	] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6109
	    self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6110
	]
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6111
    ].
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6112
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6113
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6114
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6115
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6116
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6117
    "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
  6118
     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
  6119
     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
  6120
     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
  6121
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6122
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6123
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6124
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6125
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6126
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6127
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  6128
dispatchLoop
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  6129
    preWaitAction := [self flush].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  6130
    Processor addPreWaitAction:preWaitAction.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  6131
    [
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6132
	super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  6133
    ] ensure:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6134
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6135
	preWaitAction := nil.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  6136
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  6137
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  6138
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6139
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6140
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6141
     (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
  6142
     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
  6143
     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
  6144
     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
  6145
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6146
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6147
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6148
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  6149
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  6150
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  6151
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6152
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6153
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6154
	    self dispatchExposeEventFor:dispatchingExpose
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6155
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6156
	^ self
6032
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  6157
    ].
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  6158
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6159
    [self eventPendingWithSync:false] whileTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6160
	eventArray isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6161
	    eventArray := Array new:13.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6162
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6163
	(self getEventFor:nil withMask:nil into:eventArray) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6164
	    AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6165
		ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6166
	    ] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6167
		self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6168
		"/ multi-screen config: give others a chance
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6169
		"/ (needed because we run at high (non-timesliced) prio)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6170
		Processor yield.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6171
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6172
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6173
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6174
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6175
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6176
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6177
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6178
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6179
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6180
     events matching the mask are thrown away regardless of which
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6181
     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
  6182
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6183
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6184
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  6185
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6186
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6187
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6188
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6189
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6190
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6191
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6192
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6193
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6194
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6195
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6196
	    win = __WindowVal(aWindowIdOrNil);
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  6197
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  6198
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6199
	} else {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  6200
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  6201
		;;
6517
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
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6204
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6205
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6206
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6207
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6208
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6209
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6210
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6211
    "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
  6212
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6213
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6214
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6215
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6216
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6217
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6218
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6219
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6220
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6221
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6222
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6223
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6224
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6225
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6226
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6227
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6228
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6229
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6230
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6231
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6232
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6233
    else if (anEventSymbol == @symbol(substructureNotify)) m = SubstructureNotifyMask;
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6234
    else if (anEventSymbol == @symbol(substructureRedirect)) m = SubstructureRedirectMask;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6235
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6236
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6237
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6238
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6239
eventPending
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6240
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6241
     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
  6242
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6243
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6244
    "/ 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
  6245
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6246
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6247
    dispatchingExpose notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6248
	^ self exposeEventPendingFor:dispatchingExpose withSync:ConservativeSync
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6249
    ].
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6250
    ^ self eventPendingWithSync:ConservativeSync
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6251
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6252
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6253
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6254
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6255
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6256
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6257
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6258
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6259
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6260
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6261
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6262
    "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
  6263
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6264
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6265
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6266
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6267
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6268
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6269
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6270
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6271
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6272
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6273
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6274
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6275
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6276
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6277
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6278
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6279
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6280
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6281
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6282
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6283
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6284
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6285
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6286
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6287
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6288
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6289
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6290
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6291
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6292
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6293
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6294
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6295
eventPendingWithSync:doSync
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6296
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6297
     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
  6298
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6299
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6300
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6301
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6302
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6303
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6304
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6305
	Display *dpy = myDpy;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6306
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6307
	if (XEventsQueued(dpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6308
	    RETURN (true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6309
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6310
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6311
	ENTER_XLIB();
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6312
	if (doSync == true) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6313
	    XSync(dpy, 0);      /* make certain everything is flushed */
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6314
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6315
	if (XEventsQueued(dpy, QueuedAfterFlush)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6316
	    rslt = true;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6317
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6318
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6319
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6320
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6321
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6322
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6323
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6324
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6325
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6326
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6327
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6328
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6329
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6330
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6331
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6332
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6333
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6334
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6335
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6336
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6337
     (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
  6338
      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
  6339
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6340
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6341
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6342
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6343
	if (XEventsQueued(myDpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6344
	    RETURN(true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6345
	}
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6346
    }
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6347
    RETURN ( false );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6348
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6349
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6350
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6351
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6352
    "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
  6353
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6354
     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
  6355
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6356
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6357
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6358
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6359
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6360
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6361
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6362
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6363
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6364
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6365
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6366
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6367
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6368
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6369
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6370
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6371
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6372
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6373
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6374
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6375
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6376
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
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
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6379
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6380
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6381
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6382
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6383
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6384
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6385
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6386
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6387
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6388
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6389
    "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
  6390
     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
  6391
     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
  6392
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6393
     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
  6394
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6395
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6396
     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
  6397
     the fields are:
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6398
	1:      windowID
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6399
	2:      eventType-ID
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6400
	3:      eventTypeSymbol
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6401
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6402
	4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6403
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  6404
     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
  6405
     handler method to allow UNLIMITEDSTACK here.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6406
     (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
  6407
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6408
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6409
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6410
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6411
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6412
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6413
    Window win, wWanted;
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6414
    long evMask;
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6415
    int returnValue;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6416
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6417
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6418
    KeySym keySym;
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6419
    unsigned char buffer[64];
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6420
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6421
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6422
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6423
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6424
    if (! ISCONNECTED) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6425
	RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6426
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6427
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6428
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6429
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6430
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6431
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6432
    if (__isSmallInteger(eventMask)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6433
	evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6434
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6435
	evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6436
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6437
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6438
    if (__isExternalAddress(aViewIdOrNil)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6439
	wWanted = __WindowVal(aViewIdOrNil);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6440
	returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6441
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6442
	if (evMask == ~0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6443
	    XNextEvent(dpy, &ev);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6444
	    returnValue = 1;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6445
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6446
	    returnValue = XCheckMaskEvent(dpy, evMask, &ev);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6447
	}
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6448
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6449
    if (!returnValue) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6450
	/* there is no event */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6451
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6452
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6453
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6454
    if (anEventArray == nil) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6455
	/* sender is not interested in the event */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6456
	RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6457
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6458
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6459
    if (!__isArray(anEventArray)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6460
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6461
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6462
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6463
    if (__arraySize(anEventArray) < 11) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6464
	console_fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6465
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6466
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6467
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  6468
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask)
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6469
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6470
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6471
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6472
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6473
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6474
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6475
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6476
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6477
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6478
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6479
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6480
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6481
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6482
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6483
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6484
#   define rr ((XResizeRequestEvent *)&ev)
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6485
#   define rpe ((XReparentEvent *)&ev)
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6486
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6487
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6488
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6489
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6490
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6491
    if (((t = __INST(lastId)) != nil)
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6492
	 && __isExternalAddress(t)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6493
	 && (__WindowVal(t) == ae->window)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6494
	windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6495
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6496
	windowID = __MKEXTERNALADDRESS(ae->window);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6497
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6498
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6499
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6500
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6501
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6502
    switch (ev.type) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6503
	case KeyRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6504
	    sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6505
	    goto keyPressAndRelease;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6506
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6507
	case KeyPress:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6508
	    sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6509
	    /* FALL INTO */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6510
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6511
	keyPressAndRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6512
	    arg = nil;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6513
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6514
	    if (nchars == 1 && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6515
		|| (buffer[0] >= 0x80))) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6516
		arg = __MKCHARACTER(buffer[0]);
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6517
//            } else if (nchars > 2) {
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6518
//                arg = __MKSTRING_L(buffer, nchars);
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6519
	    } else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6520
		keySymString = XKeysymToString(keySym);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6521
		if (keySymString) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6522
		    arg = __MKSYMBOL(keySymString, 0);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6523
		}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6524
	    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6525
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6526
#ifdef IGNORE_UNKNOWN_KEYCODES
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6527
	    if (arg == nil) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6528
		/* happens sometimes (alt-graph on sun has no keysym) */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6529
		RETURN (false);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6530
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6531
#endif
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6532
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6533
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6534
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6535
	    t = __MKUINT(ke->keycode); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6536
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6537
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6538
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6539
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6540
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6541
	    t = __MKUINT(ke->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6542
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6543
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6544
	case ButtonPress:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6545
	    sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6546
	    goto buttonPressAndRelease;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6547
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6548
	case ButtonRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6549
	    sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6550
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6551
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6552
	buttonPressAndRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6553
	    __ArrayInstPtr(anEventArray)->a_element[2] = sym;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6554
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6555
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6556
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6557
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6558
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6559
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6560
	    t = __MKUINT(be->time); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6561
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6562
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6563
	case MotionNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6564
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6565
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6566
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6567
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6568
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6569
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6570
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6571
	    t = __MKUINT(me->time); __ArrayInstPtr(anEventArray)->a_element[8] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6572
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6573
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6574
	case FocusIn:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6575
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6576
	    goto focusInOut;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6577
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6578
	case FocusOut:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6579
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6580
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6581
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6582
	focusInOut:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6583
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6584
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6585
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6586
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6587
	case EnterNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6588
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6589
	    goto enterLeave;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6590
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6591
	case LeaveNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6592
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6593
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6594
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6595
	enterLeave:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6596
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6597
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6598
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6599
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6600
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6601
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6602
	    __ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6603
	    t = __MKUINT(ele->time); __ArrayInstPtr(anEventArray)->a_element[10] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6604
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6605
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6606
	case Expose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6607
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6608
	    goto expose;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6609
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6610
	case GraphicsExpose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6611
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6612
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6613
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6614
	expose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6615
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6616
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6617
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6618
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6619
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6620
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6621
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6622
	case NoExpose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6623
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6624
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6625
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6626
	case VisibilityNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6627
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6628
	    switch (ve->state) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6629
		case VisibilityUnobscured:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6630
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6631
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6632
		case VisibilityPartiallyObscured:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6633
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6634
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6635
		case VisibilityFullyObscured:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6636
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6637
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6638
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6639
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6640
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6641
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6642
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6643
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6644
	case CreateNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6645
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6646
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6647
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6648
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6649
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6650
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6651
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6652
	case DestroyNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6653
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6654
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6655
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6656
	case UnmapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6657
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6658
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6659
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6660
	case MapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6661
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6662
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6663
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6664
	case ConfigureNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6665
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:relativeTo:x:y:width:height:borderWidth:above:overrideRedirect:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6666
	    __ArrayInstPtr(anEventArray)->a_element[3] = nil;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6667
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6668
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6669
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->width);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6670
	    __ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ce->height);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6671
	    __ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ce->border_width);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6672
	   __ArrayInstPtr(anEventArray)->a_element[9] = nil;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6673
	    __ArrayInstPtr(anEventArray)->a_element[10] = ce->override_redirect ? true : false;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6674
	    if (ce->event != None) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6675
		t = __MKEXTERNALADDRESS(ce->event); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6676
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6677
	    if (ce->above != None) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6678
		t = __MKEXTERNALADDRESS(ce->above); __ArrayInstPtr(anEventArray)->a_element[9] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6679
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6680
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6681
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6682
	case GravityNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6683
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6684
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6685
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6686
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6687
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6688
	case ResizeRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6689
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6690
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6691
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6692
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6693
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6694
	case ConfigureRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6695
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6696
	    __ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6697
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6698
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6699
	    __ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6700
	    __ArrayInstPtr(anEventArray)->a_element[7] = nil;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6701
	    if (cr->above != None) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6702
		t = __MKEXTERNALADDRESS(cr->above); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6703
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6704
	    switch (cr->detail) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6705
		case Above:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6706
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6707
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6708
		case Below:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6709
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6710
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6711
		case TopIf:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6712
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6713
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6714
		case BottomIf:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6715
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6716
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6717
		case Opposite:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6718
		    __ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6719
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6720
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6721
		    __ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6722
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6723
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6724
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6725
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6726
	case CirculateNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6727
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6728
	    goto circulate;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6729
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6730
	case CirculateRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6731
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6732
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6733
	circulate:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6734
	    switch (cie->place) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6735
		case PlaceOnTop:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6736
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6737
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6738
		case PlaceOnBottom:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6739
		    __ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6740
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6741
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6742
		    __ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6743
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6744
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6745
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6746
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6747
	case PropertyNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6748
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:property:state:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6749
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6750
	    switch (pe->state) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6751
		case PropertyNewValue:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6752
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6753
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6754
		case PropertyDelete:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6755
		    __ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6756
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6757
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6758
		    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6759
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6760
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6761
	    t = __MKUINT(pe->time); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6762
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6763
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6764
	case SelectionClear:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6765
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:selection:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6766
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6767
	    t = __MKUINT(sce->time); __ArrayInstPtr(anEventArray)->a_element[4] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6768
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6769
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6770
	case SelectionRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6771
	    /*
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6772
	     * someone wants the selection
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6773
	     */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6774
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6775
	    t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6776
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6777
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6778
	    __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6779
	    t = __MKUINT(ev.xselectionrequest.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6780
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6781
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6782
	case SelectionNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6783
	    /*
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6784
	     * returned selection value (answer from SelectionRequest)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6785
	     */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6786
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6787
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6788
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6789
	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6790
	    t = __MKEXTERNALADDRESS(ev.xselection.requestor); __ArrayInstPtr(anEventArray)->a_element[6] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6791
	    t = __MKUINT(ev.xselection.time); __ArrayInstPtr(anEventArray)->a_element[7] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6792
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6793
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6794
	case ColormapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6795
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6796
	    __ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6797
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6798
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6799
	case ClientMessage:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6800
	    if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6801
		if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom)))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6802
		 || (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6803
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6804
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6805
		}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6806
		if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6807
		    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6808
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6809
		}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6810
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6811
	    /*
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6812
	     * any other client message
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6813
	     */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6814
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6815
	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6816
	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6817
	    t = __MKBYTEARRAY(&ev.xclient.data, sizeof(ev.xclient.data)); __ArrayInstPtr(anEventArray)->a_element[5] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6818
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6819
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6820
	case MappingNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6821
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6822
	    switch(mape->request) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6823
		case MappingModifier:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6824
		    arg = @symbol(mappingModifier);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6825
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6826
		case MappingKeyboard:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6827
		    arg = @symbol(mappingKeyboard);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6828
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6829
		case MappingPointer:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6830
		    arg = @symbol(mappingPointer);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6831
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6832
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6833
		    arg = __MKSMALLINT(mape->request);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6834
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6835
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6836
	    __ArrayInstPtr(anEventArray)->a_element[3] = arg;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6837
	    t = __MKBYTEARRAY(&ev, sizeof(*mape)); __ArrayInstPtr(anEventArray)->a_element[4] = t;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6838
	    __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6839
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6840
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6841
	case KeymapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6842
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6843
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6844
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6845
	case MapRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6846
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6847
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6848
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6849
	case ReparentNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6850
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:parentId:x:y:);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6851
	    t = __MKEXTERNALADDRESS(rpe->parent);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6852
	    __ArrayInstPtr(anEventArray)->a_element[3] = t; __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6853
	    __ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rpe->x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6854
	    __ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(rpe->y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6855
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6856
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6857
	default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6858
	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6859
	    break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6860
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6861
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6862
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6863
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6864
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6865
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6866
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6867
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6868
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6869
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6870
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6871
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6872
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6873
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6874
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6875
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6876
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6877
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6878
#undef rr
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6879
#undef rpe
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6880
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  6881
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6882
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6883
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6884
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6885
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6886
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6887
    ^ true
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6888
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6889
    "Modified: / 17-05-2018 / 18:26:09 / Stefan Vogel"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6890
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6891
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6892
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6893
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6894
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6895
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6896
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6897
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6898
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6899
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6900
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  6901
    dispatchingExpose := aView drawableId.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  6902
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  6903
    "Modified: / 26-04-2018 / 11:01:37 / stefan"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6904
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6905
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6906
registerHotKeyForWindow:aDrawableId withId:anId modifiers:aModifier virtualKeyCode:aVirtualKeyCode
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6907
    "Defines a system-wide hotkey."
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6908
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6909
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6910
    "no-op until implemented"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6911
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6912
    ^ false.
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6913
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6914
    "Modified (comment): / 06-08-2018 / 15:37:45 / Claus Gittinger"
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6915
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6916
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6917
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6918
    "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
  6919
     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
  6920
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6921
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6922
%{
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6923
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6924
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6925
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6926
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6927
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6928
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6929
	mask = __intVal(aMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6930
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6931
#ifdef OLD
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6932
	/* these may not be disabled */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6933
	mask |= ExposureMask | StructureNotifyMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6934
		KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6935
		EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6936
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6937
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6938
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6939
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6940
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6941
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6942
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6943
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6944
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6945
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6946
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6947
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6948
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6949
    "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
  6950
6252
35df59ca8863 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  6951
    (dispatchProcess notNil and:[dispatchProcess isDead not]) ifTrue:[^ self].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6952
    dispatchingExpose := nil.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  6953
    super startDispatch.
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6954
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6955
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6956
unregisterHotKeyForWindow:aDrawableId withId:anId
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6957
    "Release a system-wide hotkey."
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6958
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6959
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6960
    "no-op until implemented. Since we never registered anything, the unregister succeeds"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6961
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6962
    ^ true.
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6963
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6964
    "Modified (comment): / 06-08-2018 / 15:37:41 / Claus Gittinger"
6294
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6965
!
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6966
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6967
viewIsRelevantInCheckForEndOfDispatch:aView
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6968
    aView == windowGroupWindow ifTrue:[^ false].
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6969
    ^ super viewIsRelevantInCheckForEndOfDispatch:aView
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6970
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6971
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6972
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6973
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6974
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
  6975
    "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
  6976
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6977
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6978
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6979
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6980
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6981
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6982
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6983
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6984
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6985
    "/ Event.xclient.format            = msgFormat;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6986
    "/ Event.xclient.window            = windowID;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6987
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6988
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6989
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6990
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6991
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6992
    "/
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6993
    "/ XSendEvent(dpy, targetWindowID, propagate, eventMask, &Event);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6994
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6995
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6996
%{
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6997
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6998
    int state;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6999
    int __eventMask;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7000
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7001
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7002
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  7003
     && __isInteger(msgFormat)
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  7004
     && (eventMask == nil || __isInteger(eventMask))
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  7005
     && (__isExternalAddress(windowID) || __isInteger(windowID))
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7006
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7007
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7008
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7009
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7010
	Window targetWindow;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7011
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7012
	if (__isInteger(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7013
	    ev.xclient.data.l[0] = __longIntVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7014
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7015
	    if (__isExternalAddress(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7016
		ev.xclient.data.l[0] = (INT)__externalAddressVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7017
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7018
		ev.xclient.data.l[0] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7019
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7020
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7021
	if (__isInteger(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7022
	    ev.xclient.data.l[1] = __longIntVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7023
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7024
	    if (__isExternalAddress(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7025
		ev.xclient.data.l[1] = (INT)__externalAddressVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7026
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7027
		ev.xclient.data.l[1] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7028
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7029
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7030
	if (__isInteger(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7031
	    ev.xclient.data.l[2] = __longIntVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7032
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7033
	    if (__isExternalAddress(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7034
		ev.xclient.data.l[2] = (INT)__externalAddressVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7035
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7036
		ev.xclient.data.l[2] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7037
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7038
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7039
	if (__isInteger(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7040
	    ev.xclient.data.l[3] = __longIntVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7041
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7042
	    if (__isExternalAddress(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7043
		ev.xclient.data.l[3] = (INT)__externalAddressVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7044
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7045
		ev.xclient.data.l[3] = 0;
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
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7048
	if (__isInteger(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7049
	    ev.xclient.data.l[4] = __longIntVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7050
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7051
	    if (__isExternalAddress(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7052
		ev.xclient.data.l[4] = (INT)__externalAddressVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7053
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7054
		ev.xclient.data.l[4] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7055
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7056
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7057
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7058
	if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7059
	    ev.xclient.window = __WindowVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7060
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7061
	    ev.xclient.window = (Window)__longIntVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7062
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7063
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7064
	if (__isExternalAddress(targetWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7065
	    targetWindow = __WindowVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7066
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7067
	    targetWindow = (Window)__longIntVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7068
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7069
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7070
	ev.xclient.type              = ClientMessage;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7071
	ev.xclient.display           = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7072
	ev.xclient.message_type      = __longIntVal(msgType);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7073
	ev.xclient.format            = __longIntVal(msgFormat);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7074
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7075
	if (eventMask == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7076
	    __eventMask = NoEventMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7077
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7078
	    __eventMask = __longIntVal(eventMask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7079
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7080
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7081
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7082
	result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7083
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7084
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7085
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7086
	    DPRINTF(("bad status in sendClientEvent\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7087
	    RETURN ( false )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7088
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7089
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7090
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7091
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7092
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7093
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7094
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  7095
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7096
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7097
    ^ self
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7098
	sendKeyOrButtonEvent:typeSymbol
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7099
	x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7100
	toViewId:targetId useXTest:false
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7101
!
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7102
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7103
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId useXTest:useXTestBoolean
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7104
    "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
  7105
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7106
     For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...);
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7107
     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
  7108
     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
  7109
     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
  7110
     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
  7111
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7112
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7113
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7114
%{
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7115
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7116
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7117
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7118
    if (__isSmallInteger(stateMask)) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7119
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7120
    } else {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7121
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7122
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7123
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7124
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7125
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  7126
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr))
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7127
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7128
	Display *dpy = myDpy;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7129
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7130
	XEvent ev;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7131
	Window target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7132
	Status result;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7133
	KeySym keySym, *syms;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7134
	int screen = __intVal(__INST(screen));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7135
	int nSyms;
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7136
	int isButtonEvent = 0, isKeyEvent = 0;
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7137
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7138
	if ((typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7139
	 || (typeSymbol == @symbol(keyRelease))) {
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7140
	    isKeyEvent = 1;
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7141
	    ev.xany.type = (typeSymbol == @symbol(keyPress))
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7142
				? KeyPress : KeyRelease;
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7143
	    if (__isStringLike(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7144
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7145
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7146
		if (__isCharacter(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7147
		    char s[2];
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7148
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7149
		    s[1] = '\0';
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7150
		    keySym = XStringToKeysym(s);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7151
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7152
		    if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7153
			keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7154
		    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7155
			goto notOk;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7156
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7157
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7158
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7159
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7160
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7161
	    if (stateMask == nil) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7162
		/*
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7163
		 * get the modifier from the keySym
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7164
		 */
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7165
		nSyms = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7166
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7167
		if (syms) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7168
		    int i;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7169
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7170
		    for (i=0; i<nSyms; i++) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7171
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7172
#ifdef MODIFIERDEBUG
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7173
			    console_printf("modifier-index is %d\n", i);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7174
#endif
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7175
			    if (i) state = (1 << (i-1));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7176
			    break;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7177
			}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7178
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7179
		    XFree(syms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7180
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7181
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7182
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7183
	    if ((typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7184
	     || (typeSymbol == @symbol(buttonRelease))) {
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7185
		isButtonEvent = 1;
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7186
		ev.xany.type = (typeSymbol == @symbol(buttonPress))
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7187
				? ButtonPress : ButtonRelease;
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7188
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7189
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7190
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7191
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7192
		    ev.xbutton.button = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7193
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7194
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7195
		DPRINTF(("invalid sendEvent typeSymbol\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7196
		RETURN (false);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7197
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7198
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7199
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7200
	if (__isExternalAddress(targetId)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7201
	    target = __WindowVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7202
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7203
	    target = (Window) __longIntVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7204
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7205
	ev.xkey.window = target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7206
	ev.xkey.same_screen = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7207
	ev.xkey.subwindow = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7208
	ev.xkey.root = RootWindow(dpy, screen);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7209
	ev.xkey.x = __intVal(xPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7210
	ev.xkey.y = __intVal(yPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7211
	ev.xkey.state = state;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7212
	ev.xkey.time = CurrentTime;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7213
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7214
	ENTER_XLIB();
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7215
#ifdef XTEST
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7216
	if (useXTestBoolean == true) {
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7217
	    if (isButtonEvent) {
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7218
		XTestFakeButtonEvent(dpy, ev.xbutton.button, ev.xany.type == ButtonPress, CurrentTime);
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7219
	    } else {
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7220
		XTestFakeKeyEvent(dpy, ev.xkey.keycode, ev.xany.type == KeyPress, CurrentTime);
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7221
	    }
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7222
	} else
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7223
#endif
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7224
	{
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7225
	    result = XSendEvent(dpy, target, False, 0 , &ev);
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  7226
	}
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7227
	LEAVE_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7228
	if ((result == BadValue) || (result == BadWindow)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7229
	    DPRINTF(("bad status\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7230
	    RETURN ( false )
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7231
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7232
	RETURN (true)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7233
    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7234
  notOk: ;
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7235
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7236
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7237
    ^ false
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7238
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7239
    "<<END
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7240
     |v|
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7241
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7242
     v := EditTextView extent:200@100.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7243
     v contents:'Hello world'.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7244
     v openAndWait.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7245
     v selectFromCharacterPosition:1 to:5.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7246
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7247
     "/ CTRL-c
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7248
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7249
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7250
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7251
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7252
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7253
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7254
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7255
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7256
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7257
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7258
	 keyOrButton:'c'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7259
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7260
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7261
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7262
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7263
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7264
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7265
	 keyOrButton:'c'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7266
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7267
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7268
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7269
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7270
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7271
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7272
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7273
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7274
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7275
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7276
     "/ CTRL-v
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7277
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7278
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7279
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7280
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7281
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7282
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7283
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7284
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7285
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7286
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7287
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7288
	 keyOrButton:'v'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7289
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7290
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7291
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7292
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7293
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7294
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7295
	 keyOrButton:'v'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7296
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7297
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7298
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7299
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7300
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7301
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7302
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7303
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7304
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7305
END"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7306
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7307
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7308
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7309
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7310
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7311
    "a basic method for X-font allocation; this method allows
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  7312
     any font to be acquired (even those not conforming to
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7313
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7314
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7315
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7316
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  7317
%{  /* STACK: 100000 */
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  7318
    /*** UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7319
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7320
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7321
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  7322
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  7323
     && __isStringLike(aFontName)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7324
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7325
	ENTER_XLIB();
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7326
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7327
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  7328
#ifdef COUNT_RESOURCES
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7329
	if (newFont)
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7330
	    __cnt_font++;
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7331
#endif
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7332
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7333
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7334
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7335
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  7336
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7337
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7338
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7339
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7340
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7341
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7342
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7343
     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
  7344
      -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
  7345
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7346
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7347
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7348
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7349
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7350
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7351
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7352
    fields size == 3 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7353
	"take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7354
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7355
	style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7356
	size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7357
    ] ifFalse:[fields size == 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7358
	"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7359
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7360
	size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7361
    ] ifFalse:[fields size >= 15 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7362
	family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7363
	face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7364
	style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7365
	style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7366
	    style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7367
	] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7368
	     style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7369
	] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7370
	     style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7371
	]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7372
	moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7373
	(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7374
	    style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7375
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7376
	fheight := fields at:8.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7377
	size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7378
	resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7379
	resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7380
	registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7381
	encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7382
	coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7383
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7384
	^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7385
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7386
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7387
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7388
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7389
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7390
encodingOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7391
    "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
  7392
     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
  7393
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7394
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7395
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7396
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7397
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7398
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7399
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7400
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7401
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7402
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7403
    coll notNil ifTrue:[ coll := self atomName:coll].
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
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7406
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7407
     "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7408
       Screen current encodingOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7409
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7410
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7411
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7412
extentsOf:aString from:index1 to:index2 inFont:aFontId into:anArray
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7413
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7414
    <context: #return>
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7415
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7416
%{  /* UNLIMITEDSTACK */
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7417
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7418
    XFontStruct *f;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7419
    char *cp;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7420
    int len, n, i1, i2, l;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7421
#   define NLOCALBUFFER 200
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7422
    XChar2b xlatebuffer[NLOCALBUFFER];
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7423
    int nInstBytes;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7424
    int directionReturn, fontAscentReturn, fontDescentReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7425
    XCharStruct overAllReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7426
    OBJ *resultArray;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7427
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7428
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7429
	 && __bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7430
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7431
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7432
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7433
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7434
	if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7435
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7436
	if (__isArray(anArray) && __arraySize(anArray) > 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7437
	    resultArray = __arrayVal(anArray);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7438
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7439
	    resultArray = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7440
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7441
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7442
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7443
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7444
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7445
	    OBJ cls;
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
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7448
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7449
		RETURN ( __MKSMALLINT(0) );
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7452
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7453
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7454
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7455
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7456
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7457
		if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7458
		cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7459
		len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7460
					&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7461
					&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7462
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7463
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7464
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7465
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7466
		n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7467
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7468
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7469
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7470
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7471
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7472
		    len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7473
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7474
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7475
		} else  if (__isWords(aString)) { /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7476
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7477
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7478
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7479
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7480
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7481
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7482
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7483
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7484
		    n = n / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7485
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7486
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7487
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7488
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7489
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7490
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7491
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7492
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7493
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7494
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7495
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7496
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7497
		    if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7498
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7499
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7500
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7501
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7502
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7503
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7504
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7505
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7506
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7507
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7508
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7509
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7510
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7511
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7512
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7513
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7514
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7515
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7516
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7517
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7518
		} else if (__isLongs(aString)) { /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7519
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7520
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7521
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7522
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7523
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7524
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7525
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7526
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7527
		    n = n / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7528
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7529
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7530
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7531
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7532
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7533
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7534
		     * 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
  7535
		     * 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
  7536
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7537
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7538
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7539
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7540
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7541
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7542
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7543
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7544
			int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7545
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7546
			codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7547
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7548
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7549
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7550
			cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7551
			cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7552
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7553
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7554
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7555
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7556
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7557
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7558
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7559
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7560
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7561
		} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7562
		    goto fail;      /*unknown string class */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7563
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7564
	    if (resultArray) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7565
		switch (__arraySize(anArray)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7566
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7567
		case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7568
		    resultArray[7] = __MKSMALLINT(directionReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7569
		case 7:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7570
		    resultArray[6] = __MKSMALLINT(fontDescentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7571
		case 6:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7572
		    resultArray[5] = __MKSMALLINT(fontAscentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7573
		case 5:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7574
		    resultArray[4] = __MKSMALLINT(overAllReturn.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7575
		case 4:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7576
		    resultArray[3] = __MKSMALLINT(overAllReturn.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7577
		case 3:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7578
		    resultArray[2] = __MKSMALLINT(overAllReturn.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7579
		case 2:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7580
		    resultArray[1] = __MKSMALLINT(overAllReturn.rbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7581
		case 1:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7582
		    resultArray[0] = __MKSMALLINT(overAllReturn.lbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7583
		case 0:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7584
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7585
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7586
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7587
	    RETURN ( __MKSMALLINT(overAllReturn.width) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7588
	}
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7589
    }
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7590
#undef NLOCALBUFFER
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7591
fail: ;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7592
%}.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7593
    self primitiveFailedOrClosedConnection.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7594
    ^ 0
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7595
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7596
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7597
      |result|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7598
      result := Array new:8.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7599
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7600
	extentsOf:'hello World' from:1 to:11
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7601
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7602
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7603
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7604
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7605
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7606
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7607
		    size:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7608
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7609
	    )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7610
	into:result.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7611
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7612
      result
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7613
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7614
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7615
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7616
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
  7617
    "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
  7618
     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
  7619
     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
  7620
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7621
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7622
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7623
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7624
    (registry size ~~ 0) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7625
	enc := registry asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7626
	encoding size ~~ 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7627
	   enc := enc, '-', encoding asLowercase.
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
	enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7630
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7631
	(encoding size ~~ 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7632
	    enc := encoding asLowercase asSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7633
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7634
	    charSets := charSetCollections.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7635
	    (charSets notEmptyOrNil) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7636
		charSets := charSets asUppercase asCollectionOfWords.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7637
		(charSets includes:'ISO8859-1') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7638
		    enc := #'iso8859-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7639
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7640
		    (charSets includes:'ISO8859') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7641
			enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7642
		    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7643
			(charSets includes:'ASCII') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7644
			    enc := #ascii
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7645
			] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7646
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7647
				enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7648
			    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7649
			]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7650
		    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7651
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7652
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7653
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7654
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7655
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7656
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7657
    "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
  7658
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7659
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7660
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7661
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7662
    "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
  7663
     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
  7664
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7665
    listOfXFonts := nil.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7666
    XftFontDescription notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7667
	XftFontDescription flushListOfAvailableFonts.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7668
    ].
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7669
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7670
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7671
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7672
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7673
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7674
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7675
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7676
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7677
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7678
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7679
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7680
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7681
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7682
     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
  7683
      -brand-family-face-style-moreStyle- -pxlSize-size-resX-resY-??-??-registry-encoding;
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7684
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7685
6010
6d7184a6456b cast to correct types
Stefan Vogel <sv@exept.de>
parents: 6009
diff changeset
  7686
    |family face style moreStyle size
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7687
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7688
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7689
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7690
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7691
    Error handle:[:ex |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7692
	family := nil.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7693
    ] do:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7694
	fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7695
	fields size == 3 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7696
	    "take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7697
	    family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7698
	    style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7699
	    size := Number readFromString:(fields at:3).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7700
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7701
	    fields size == 2 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7702
		"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7703
		family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7704
		size := Number readFromString:(fields at:2).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7705
	    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7706
		fields size >= 15 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7707
		    family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7708
		    face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7709
		    style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7710
		    style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7711
			style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7712
		    ] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7713
			 style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7714
		    ] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7715
			 style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7716
		    ]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7717
		    moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7718
		    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7719
			style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7720
		    ].
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7721
"/                    pxlSize := (Integer readFromString:(fields at:8)).
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7722
		    size := (Number readFromString:(fields at:9)) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7723
		    resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7724
		    resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7725
		    registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7726
		    encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7727
		    coding := registry , '-' , encoding.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7728
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7729
		    "/ very old name (such as cursor, 5x7 etc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7730
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7731
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7732
	].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7733
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7734
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7735
    family notNil ifTrue:[
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7736
       ^ 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
  7737
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7738
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7739
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7740
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7741
     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
  7742
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7743
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7744
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7745
fontMetricsOf:fontId
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7746
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7747
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7748
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7749
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7750
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7751
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7752
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7753
%{  /* UNLIMITEDSTACK */
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7754
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7755
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7756
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7757
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7758
	if (__isExternalAddress(fontId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7759
	    f = __FontVal(fontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7760
	    if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7761
		minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7762
		maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7763
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7764
		if (f->direction == FontLeftToRight) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7765
		    dir = @symbol(LeftToRight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7766
		} else if (f->direction == FontRightToLeft) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7767
		    dir = @symbol(RightToLeft);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7768
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7769
		avgAscent = __MKSMALLINT(f->ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7770
		avgDescent = __MKSMALLINT(f->descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7771
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7772
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7773
		minWidth = __MKSMALLINT(f->min_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7774
		maxWidth = __MKSMALLINT(f->max_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7775
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7776
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7777
		len = XTextWidth(f, "n", 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7778
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7779
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7780
		avgWidth = __MKSMALLINT( len );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7781
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7782
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7783
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7784
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7785
    avgAscent == nil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7786
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7787
	^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7788
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7789
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7790
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7791
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7792
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7793
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7794
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7795
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7796
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7797
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7798
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7799
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7800
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7801
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7802
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7803
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7804
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7805
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7806
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7807
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7808
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7809
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7810
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7811
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7812
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7813
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7814
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7815
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7816
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7817
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7818
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7819
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7820
     PropertyNames is an array with property names (symbols or strings).
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  7821
     Nonexistent properties are returned as nil"
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7822
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7823
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7824
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7825
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7826
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7827
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7828
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7829
     Screen current
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7830
	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistent)
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7831
	of:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7832
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7833
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7834
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7835
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7836
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7837
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7838
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7839
     Even indices contain the property value (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7840
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7841
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7842
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7843
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7844
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7845
%{
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7846
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7847
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7848
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7849
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7850
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7851
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7852
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7853
	if (f && (prop = f->properties) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7854
	    n = f->n_properties;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7855
	    propsArray = __ARRAY_NEW_INT(n*2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7856
	    for (i = 0; n; n--, prop++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7857
		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
  7858
		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
  7859
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7860
	}
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7861
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7862
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7863
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7864
    propsArray notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7865
	propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7866
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7867
    ^ result
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7868
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7869
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7870
     Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7871
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1'))
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7872
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7873
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7874
     d := Dictionary new.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7875
     (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
  7876
	  d at:name put:((Screen current atomName:value) ? value)
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7877
     ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7878
     d
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7879
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7880
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7881
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7882
fontResolutionOf:fontId
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7883
    "return the resolution (as dpiX @ dpiY) of the font - this is usually the display's resolution,
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7884
     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
  7885
     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
  7886
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7887
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7888
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7889
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7890
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7891
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  7892
    (resX notNil and:[resY notNil]) ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  7893
	^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7894
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7895
    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
  7896
    res notNil ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  7897
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7898
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7899
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7900
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7901
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7902
      Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7903
    "
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7904
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7905
    "Modified (comment): / 01-09-2017 / 09:58:19 / cg"
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7906
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7907
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  7908
fullFontNameOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7909
    "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
  7910
     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
  7911
     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
  7912
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7913
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  7914
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7915
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7916
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7917
	|fullNameID|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7918
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7919
	fullNameID := props at:try ifAbsent:nil.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7920
	fullNameID notNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7921
	    fullName := self atomName:fullNameID.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7922
	    fullName notEmptyOrNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7923
		^ fullName
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7924
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7925
	]
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7926
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7927
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7928
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7929
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7930
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7931
     Screen current fullFontNameOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7932
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7933
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7934
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7935
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7936
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7937
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7938
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7939
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7940
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7941
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7942
    int nnames = 30000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7943
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7944
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7945
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7946
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7947
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7948
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7949
	if (__isStringLike(pattern)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7950
	    for (;;) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7951
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7952
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7953
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7954
		if (fonts == 0) RETURN(nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7955
		if (available < nnames) break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7956
		XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7957
		nnames = available * 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7958
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7959
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7960
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7961
	     * now, that we know the number of font names,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7962
	     * create the array ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7963
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7964
	    arr = __ARRAY_NEW_INT(available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7965
	    if (arr != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7966
		/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7967
		 * ... and fill it
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7968
		 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7969
		for (i=0; i<available; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7970
		    __PROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7971
		    str = __MKSTRING(fonts[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7972
		    __UNPROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7973
		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7974
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7975
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7976
	    XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7977
	    RETURN (arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7978
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7979
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7980
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7981
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7982
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7983
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7984
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7985
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7986
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7987
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7988
getDefaultFontWithEncoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7989
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7990
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7991
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7992
    |id|
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7993
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7994
    id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding.
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7995
    id isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7996
	id := self createFontFor:'fixed'
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7997
    ].
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7998
    ^ id.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7999
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8000
     "
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  8001
       Screen current getDefaultFontWithEncoding:#'iso10646-1'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8002
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8003
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8004
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8005
getFontWithFamily:familyString face:faceString
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8006
	    style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8007
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8008
    "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
  8009
     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
  8010
     as family and the other parameters as nil. For example, the cursor font
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  8011
     can be acquired that way."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8012
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8013
    |styleString theName theId xlatedStyle
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8014
     id spacing encodingMatch idx roundedSize pixelSize pointSize|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8015
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8016
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8017
5176
0c9f21d81a71 preps for pixel-sized fonts
Claus Gittinger <cg@exept.de>
parents: 5071
diff changeset
  8018
    sizeArgOrNil notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8019
	roundedSize := sizeArgOrNil rounded asInteger.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8020
	sizeUnit == #px ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8021
	    pixelSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8022
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8023
	    pointSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8024
	].
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  8025
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  8026
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8027
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8028
    faceString isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8029
	roundedSize notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8030
	    theName := familyString , '-' , roundedSize printString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8031
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8032
	    theName := familyString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8033
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8034
	theName notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8035
	    theId := self createFontFor:theName.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8036
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8037
	theId isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8038
	    theId := self getDefaultFontWithEncoding:encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8039
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8040
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8041
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8042
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8043
    "/ 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
  8044
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8045
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  8046
    (styleString notNil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8047
     and:[(styleString endsWith:'-narrow')
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8048
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8049
	|i|
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8050
	i := styleString lastIndexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8051
	spacing := styleString copyFrom:(i+1).
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8052
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8053
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8054
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8055
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8056
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8057
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8058
    xlatedStyle notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8059
	xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  8060
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  8061
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  8062
    encoding isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8063
	encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  8064
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8065
	idx := encoding indexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8066
	idx ~~ 0 ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8067
	    encodingMatch := encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8068
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8069
	    encodingMatch := encoding , '-*'.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8070
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  8071
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  8072
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8073
    id := self
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8074
	    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8075
	    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8076
	    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8077
	    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8078
	    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8079
	    pixelSize:pixelSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8080
	    size:pointSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8081
	    encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8082
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8083
    id isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8084
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8085
	    "/ too stupid: registries come in both cases
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8086
	    "/ and X does not ignore case
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8087
	    "/
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8088
	    id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8089
		    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8090
		    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8091
		    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8092
		    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8093
		    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8094
		    pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8095
		    size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8096
		    encoding:encodingMatch asUppercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8097
	    id isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8098
		id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8099
			getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8100
			family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8101
			weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8102
			slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8103
			spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8104
			pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8105
			size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8106
			encoding:encodingMatch asLowercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8107
	    ]
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  8108
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8109
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8110
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8111
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  8112
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  8113
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8114
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8115
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8116
getFontWithFoundry:foundry family:family weight:weight
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8117
	      slant:slant spacing:spc pixelSize:pSize size:size
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8118
	      encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8119
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8120
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8121
     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
  8122
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8123
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8124
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8125
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8126
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8127
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8128
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8129
     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
  8130
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8131
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8132
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8133
    |theName sizeMatch
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8134
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  8135
     pSizeMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8136
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8137
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8138
    "name is:
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8139
	-foundry-family    -weight -slant-
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8140
	 sony    helvetica bold     r
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8141
	 adobe   courier   medium   i
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8142
	 msic    fixed              o
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8143
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8144
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8145
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8146
    size isNil ifTrue:[
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8147
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8148
    ] ifFalse:[
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8149
	sizeMatch := size printString , '0'
8655
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8150
    ].
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8151
    foundryMatch := foundry ? '*'.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8152
    familyMatch := family ? '*'.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8153
    weightMatch := weight ? '*'.
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8154
    slantMatch := slant ? '*'.
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8155
    spcMatch := spc ? '*'.
8655
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8156
    pSize isNil ifTrue:[
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8157
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8158
    ] ifFalse:[
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8159
	pSizeMatch := pSize printString
8655
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8160
    ].
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8161
    encodingMatch := encoding ? '*'.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8162
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8163
    theName := ('-' , foundryMatch,
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8164
		'-' , familyMatch,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8165
		'-' , weightMatch ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8166
		'-' , slantMatch ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8167
		'-' , spcMatch ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8168
		'-*' ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8169
		'-' , pSizeMatch ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8170
		'-' , sizeMatch ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8171
		'-*-*-*-*' ,
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8172
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  8173
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  8174
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8175
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8176
    ^ self createFontFor:theName.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8177
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8178
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8179
    "
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8180
     Display
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8181
	getFontWithFoundry:'*'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8182
	family:'courier'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8183
	weight:'medium'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8184
	slant:'r'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8185
	spacing:nil
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8186
	pixelSize:nil
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8187
	size:13
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8188
	encoding:#'iso8859-1'.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8189
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8190
     Display
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8191
	getFontWithFoundry:'*'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8192
	family:'courier'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8193
	weight:'medium'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8194
	slant:'r'
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8195
	spacing:nil
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8196
	pixelSize:nil
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8197
	size:13
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
  8198
	encoding:#'iso10646-1'
8655
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8199
    "
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8200
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8201
    "Modified: / 10-04-1997 / 19:15:44 / cg"
9036cf74582d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8644
diff changeset
  8202
    "Modified: / 03-03-2019 / 23:15:18 / Claus Gittinger"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8203
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8204
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8205
heightOf:aString from:index1 to:index2 inFont:aFontId
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8206
    |resultArray|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8207
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8208
    resultArray := Array new:5.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8209
    self extentsOf:aString from:index1 to:index2 inFont:aFontId into:resultArray.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8210
    ^ (resultArray at:4) + (resultArray at:5).
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8211
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8212
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8213
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8214
	heightOf:'hello world' from:1 to:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8215
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8216
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8217
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8218
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8219
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8220
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8221
		    size:13
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8222
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8223
	    ).
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8224
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8225
      Screen current
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  8226
	heightOf:'hello World gggÖÜ' from:1 to:15
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8227
	inFont:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8228
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8229
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8230
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8231
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8232
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8233
     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
  8234
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8235
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8236
6630
81c3e5842617 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6571
diff changeset
  8237
    |names listOfXftFonts|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8238
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8239
    listOfXFonts isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8240
	names := self getAvailableFontsMatching:'*'.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8241
	names isNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8242
	    "no names returned ..."
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8243
	    ^ nil
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8244
	].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8245
	listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8246
	listOfXFonts := FontDescription genericFonts, listOfXFonts.
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  8247
    ].
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  8248
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  8249
    self supportsXftFonts ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8250
	UserPreferences current useXFontsOnly ifFalse:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8251
	    listOfXftFonts := XftFontDescription listOfAvailableFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8252
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8253
	    UserPreferences current useXftFontsOnly ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8254
		^ listOfXftFonts
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8255
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8256
	    ^ listOfXftFonts , listOfXFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8257
	].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8258
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8259
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8260
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8261
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  8262
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  8263
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  8264
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  8265
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8266
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  8267
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8268
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8269
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8270
    "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
  8271
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8272
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8273
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8274
pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8275
    "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
  8276
     on this display.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8277
     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
  8278
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8279
    |sizes|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8280
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8281
    sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8282
    (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8283
	"special: in X11R5 and above, size 0 means:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8284
	 there are scaled versions in all sizes available"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8285
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8286
	^ #(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
  8287
    ].
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8288
    ^ sizes
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8289
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8290
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  8291
     Display pixelSizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8292
    "
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8293
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8294
    "Created: 27.2.1996 / 01:38:15 / cg"
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8295
!
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8296
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8297
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8298
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8299
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8300
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8301
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8302
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  8303
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  8304
     * 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
  8305
     */
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8306
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8307
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8308
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8309
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8310
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8311
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8312
	if (f) {
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
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8315
	    XFreeFont(myDpy, f);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8316
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  8317
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8318
	    __cnt_font--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8319
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8320
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8321
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8322
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8323
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8324
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8325
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8326
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8327
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8328
    "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
  8329
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8330
     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
  8331
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8332
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8333
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8334
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8335
    (sizes notNil and:[sizes includes:0]) ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8336
	"special: in X11R5 and above, size 0 means:
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8337
	 there are scaled versions in all sizes available"
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8338
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8339
	^ #(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
  8340
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8341
    ^ sizes
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
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  8344
     Display sizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8345
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8346
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8347
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8348
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8349
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8350
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8351
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8352
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8353
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8354
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8355
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8356
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8357
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8358
    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
  8359
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8360
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  8361
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8362
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8363
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8364
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8365
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8366
	if (__bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8367
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8368
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8369
	    int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8370
	    f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8371
	    if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8372
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8373
	    i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8374
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8375
	    if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8376
		OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8377
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8378
		i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8379
		if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8380
		    RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8381
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8382
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8383
		cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8384
		l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8385
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8386
		if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8387
		    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8388
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8389
			cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8390
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8391
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8392
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8393
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8394
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8395
			//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
  8396
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8397
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8398
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8399
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8400
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8401
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8402
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8403
		    }
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8406
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8407
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8408
		cp += nInstBytes;
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
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8411
		    n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8412
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8413
			cp += i1;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8414
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8415
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8416
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8417
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8418
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8419
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8420
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8421
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8422
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8423
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8424
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8425
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8426
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8427
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8428
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8429
		/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8430
		if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8431
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8432
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8433
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8434
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8435
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8436
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8437
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8438
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8439
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8440
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8441
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8442
			cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8443
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8444
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8445
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8446
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8447
			 * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8448
			 * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8449
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8450
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8451
			u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8452
			if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8453
			    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8454
				cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8455
			    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8456
				cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8457
				mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8458
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8459
			    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8460
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8461
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8462
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8463
			    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8464
			}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8465
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8466
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8467
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8468
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8469
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8470
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8471
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8472
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8473
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8474
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8475
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8476
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8477
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8478
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8479
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8480
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8481
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8482
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8483
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8484
		/* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8485
		if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8486
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8487
		    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8488
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8489
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8490
		    n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8491
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8492
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8493
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8494
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8495
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8496
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8497
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8498
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8499
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8500
			cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8501
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8502
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8503
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8504
			 * 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
  8505
			 * 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
  8506
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8507
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8508
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8509
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8510
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8511
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8512
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8513
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8514
			    int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8515
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8516
			    codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8517
			    if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8518
				codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8519
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8520
			    cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8521
			    cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8522
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8523
			cp = (char *) cp2;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8524
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8525
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8526
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8527
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8528
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8529
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8530
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8531
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8532
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8533
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8534
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8535
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8536
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8537
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8538
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8539
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8540
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8541
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8542
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8543
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8544
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8545
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8546
#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
  8547
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8548
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8549
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  8550
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8551
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8552
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  8553
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8554
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8555
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8556
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8557
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8558
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8559
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8560
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8561
    if (mode == @symbol(asyncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8562
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8563
    else if (mode == @symbol(syncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8564
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8565
    else if (mode == @symbol(asyncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8566
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8567
    else if (mode == @symbol(syncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8568
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8569
    else if (mode == @symbol(syncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8570
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8571
    else if (mode == @symbol(asyncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8572
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8573
    else if (mode == @symbol(replayPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8574
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8575
    else if (mode == @symbol(replayKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8576
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8577
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8578
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8579
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8580
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8581
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8582
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8583
	XAllowEvents(myDpy, _mode, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8584
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8585
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8586
	RETURN (self);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8587
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8588
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8589
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8590
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8591
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8592
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8593
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8594
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8595
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8596
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8597
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8598
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8599
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8600
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8601
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8602
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8603
	    result = XGrabKeyboard(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8604
				   __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8605
				   True /* False */,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8606
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8607
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8608
				   CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8609
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8610
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8611
	    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8612
	    switch(result) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8613
		case AlreadyGrabbed:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8614
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8615
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8616
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8617
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8618
		case GrabNotViewable:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8619
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8620
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8621
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8622
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8623
		case GrabInvalidTime:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8624
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8625
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8626
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8627
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8628
		case GrabFrozen:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8629
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8630
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8631
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8632
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8633
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8634
		    ok = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8635
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8636
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8637
	    if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8638
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8639
		XUngrabKeyboard(myDpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8640
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8641
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8642
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8643
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8644
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8645
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8646
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8647
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8648
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8649
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8650
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8651
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8652
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
  8653
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8654
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8655
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8656
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8657
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8658
    int result, ok;
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8659
    unsigned int evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8660
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8661
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8662
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8663
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8664
    if (ISCONNECTED) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8665
	if (__isExternalAddress(aWindowId)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8666
	    if (__isExternalAddress(confineId))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8667
		confineWin = __WindowVal(confineId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8668
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8669
		confineWin = (Window) None;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8670
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8671
	    if (__isExternalAddress(aCursorId))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8672
		curs = __CursorVal(aCursorId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8673
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8674
		curs = (Cursor) None;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8675
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8676
	    if (pMode == @symbol(sync))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8677
		pointer_mode = GrabModeSync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8678
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8679
		pointer_mode = GrabModeAsync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8680
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8681
	    if (kMode == @symbol(sync))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8682
		keyboard_mode = GrabModeSync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8683
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8684
		keyboard_mode = GrabModeAsync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8685
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8686
	    if (__isSmallInteger(eventMask))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8687
		evMask = __intVal(eventMask);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8688
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8689
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8690
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8691
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8692
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8693
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8694
*/
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8695
	    result = XGrabPointer(myDpy,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8696
				  __WindowVal(aWindowId),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8697
				  False,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8698
				  evMask,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8699
				  pointer_mode, keyboard_mode,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8700
				  confineWin,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8701
				  curs,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8702
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8703
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8704
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8705
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8706
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8707
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8708
	    ok = 0;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8709
	    switch (result) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8710
		case AlreadyGrabbed:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8711
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8712
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8713
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8714
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8715
		case GrabNotViewable:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8716
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8717
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8718
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8719
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8720
		case GrabInvalidTime:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8721
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8722
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8723
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8724
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8725
		case GrabFrozen:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8726
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8727
			console_fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8728
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8729
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8730
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8731
		    ok = 1;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8732
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8733
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8734
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8735
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8736
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8737
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8738
*/
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8739
		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
  8740
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8741
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8742
*/
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8743
		RETURN (false);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8744
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8745
	    RETURN ( true );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8746
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8747
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8748
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8749
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8750
    ^ false
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8751
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8752
    "Modified: / 17-05-2018 / 18:27:33 / Stefan Vogel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8753
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8754
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8755
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
  8756
    "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
  8757
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8758
    ^ self
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8759
	grabPointerIn:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8760
	withCursor:aCursorId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8761
	eventMask:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8762
	pointerMode:pMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8763
	keyboardMode:kMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8764
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8765
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8766
    "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
  8767
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8768
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8769
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8770
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8771
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8772
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8773
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8774
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8775
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8776
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8777
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8778
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8779
	XUngrabKeyboard(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8780
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8781
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8782
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8783
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8784
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8785
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8786
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8787
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8788
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8789
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8790
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8791
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8792
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8793
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8794
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8795
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8796
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8797
	XUngrabPointer(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8798
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8799
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8800
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8801
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8802
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8803
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8804
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8805
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8806
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8807
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8808
    activeKeyboardGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8809
	activeKeyboardGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8810
	self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8814
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8815
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8816
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8817
    activePointerGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8818
	activePointerGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8819
	self primUngrabPointer.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  8820
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8821
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8822
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8823
!XWorkstation methodsFor:'grabbing-keys'!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8824
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8825
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
  8826
    "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
  8827
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8828
     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
  8829
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8830
     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
  8831
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8832
     ModeKbd and modePtr are symbols GrabModeAsync or GrabModeSync.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8833
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8834
     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
  8835
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8836
     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
  8837
     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
  8838
     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
  8839
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8840
     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
  8841
     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
  8842
    "
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8843
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8844
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8845
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8846
%{
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8847
    unsigned int modifierMask = AnyModifier;
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8848
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8849
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8850
    if (__isStringLike(keySymCodeOrChar)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8851
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8852
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8853
	if (__isCharacter(keySymCodeOrChar)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8854
	    char s[2];
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8855
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8856
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8857
	    s[1] = '\0';
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8858
	    keySym = XStringToKeysym(s);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8859
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8860
	    if (__isSmallInteger(keySymCodeOrChar)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8861
		keySym = (KeySym) __intVal(keySymCodeOrChar);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8862
	    } else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8863
		goto notOK;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8864
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8865
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8866
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8867
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8868
    if (modifierMaskOrNil != nil) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8869
	if (__isSmallInteger(modifierMaskOrNil)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8870
	    modifierMask = __intVal(modifierMaskOrNil);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8871
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8872
	    goto notOK;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8873
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8874
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8875
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8876
    if (ISCONNECTED) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8877
	Display *dpy;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8878
	Window window;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8879
	int keyCode;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8880
	int result;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8881
	int mKbd, mPtr;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8882
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8883
	mKbd = modeKbd == @symbol(GrabModeAsync) ? GrabModeAsync :GrabModeSync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8884
	mPtr = modePtr == @symbol(GrabModeAsync) ? GrabModeAsync :GrabModeSync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8885
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8886
	dpy = myDpy;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8887
	keyCode = XKeysymToKeycode(dpy, keySym);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8888
	if (__isExternalAddress(aWindowIdOrNil)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8889
	    window = __WindowVal(aWindowIdOrNil);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8890
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8891
	    int screen;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8892
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8893
	    screen = DefaultScreen(dpy);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8894
	    window = RootWindow(dpy, screen);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8895
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8896
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8897
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8898
	result = XGrabKey (dpy,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8899
	    keyCode, modifierMask, window,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8900
	    False, mKbd, mPtr );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8901
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8902
	XSync(dpy, True);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8903
	XFlush(dpy);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8904
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8905
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8906
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8907
	if (result != Success) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8908
	    if (result == BadAccess) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8909
		__INST(lastError) = @symbol(badAccess);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8910
	    } else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8911
		__INST(lastError) = @symbol(other);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8912
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8913
	    RETURN (false);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8914
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8915
	RETURN (true);
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8916
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8917
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8918
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8919
    self primitiveFailedOrClosedConnection
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8920
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8921
    "Modified: / 03-05-2018 / 16:27:51 / stefan"
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8922
    "Modified: / 17-05-2018 / 18:29:18 / Stefan Vogel"
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8923
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8924
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8925
grabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8926
    "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
  8927
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8928
     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
  8929
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8930
     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
  8931
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8932
     Only the key is passed to myself - no permanent grab is installed.
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8933
     (GrabModeAsync).
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8934
     While the grab is active, key events for this key will be sent to
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8935
     the DisplayRootWindow"
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8936
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8937
    ^ self
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8938
	grabKey:keySymCodeOrChar
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8939
	modifier:modifierMaskOrNil
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8940
	grabModeKeyboard:#GrabModeAsync
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8941
	grabModePointer:#GrabModeAsync
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8942
	window:aWindowIdOrNil
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8943
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8944
    "
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8945
     Display grabKey:#Escape modifier:nil window:nil.
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8946
     Delay waitForSeconds:15.
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8947
     Display ungrabKey:#Escape modifier:nil window:nil.
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8948
    "
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8949
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8950
    "Modified (comment): / 28-07-2018 / 09:19:04 / Claus Gittinger"
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8951
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8952
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8953
ungrabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8954
    "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
  8955
     Read the comment there."
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8956
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8957
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8958
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8959
%{
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8960
    int modifierMask = AnyModifier;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8961
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8962
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8963
    if (__isStringLike(keySymCodeOrChar)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8964
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8965
    } else {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8966
	if (__isCharacter(keySymCodeOrChar)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8967
	    char s[2];
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8968
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8969
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8970
	    s[1] = '\0';
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8971
	    keySym = XStringToKeysym(s);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8972
	} else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8973
	    if (__isSmallInteger(keySymCodeOrChar)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8974
		keySym = (KeySym) __intVal(keySymCodeOrChar);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8975
	    } else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8976
		goto notOK;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8977
	    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8978
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8979
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8980
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8981
    if (modifierMaskOrNil != nil) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8982
	if (__isSmallInteger(modifierMaskOrNil)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8983
	    modifierMask = __intVal(modifierMaskOrNil);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8984
	} else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8985
	    goto notOK;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8986
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8987
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8988
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8989
    if (ISCONNECTED) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8990
	Display *dpy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8991
	Window window;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8992
	int keyCode;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8993
	int result;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8994
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8995
	dpy = myDpy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8996
	if (__isExternalAddress(aWindowIdOrNil)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8997
	    window = __WindowVal(aWindowIdOrNil);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8998
	} else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8999
	    int screen;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9000
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9001
	    screen = DefaultScreen(dpy);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9002
	    window = RootWindow(dpy, screen);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9003
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9004
	keyCode = XKeysymToKeycode(dpy, keySym);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9005
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9006
	ENTER_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9007
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9008
	result = XUngrabKey (dpy, keyCode, modifierMask, window);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9009
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9010
	XSync(dpy, True);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9011
	XFlush(dpy);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9012
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9013
	LEAVE_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9014
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9015
	if (result != Success) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9016
	    if (result == BadAccess) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9017
		__INST(lastError) = @symbol(badAccess);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9018
	    } else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9019
		__INST(lastError) = @symbol(other);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9020
	    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9021
	    RETURN (false);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9022
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  9023
	RETURN (true);
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  9024
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  9025
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  9026
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  9027
    self primitiveFailedOrClosedConnection
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  9028
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  9029
    "Modified: / 03-05-2018 / 16:30:34 / stefan"
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  9030
! !
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  9031
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9032
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9033
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  9034
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9035
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9036
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9037
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9038
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9039
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9040
    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
  9041
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9042
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9043
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9044
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9045
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9046
	    gcv.clip_mask = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9047
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9048
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9049
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9050
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9051
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9052
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9053
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9054
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9055
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9056
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9057
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9058
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9059
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9060
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9061
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9062
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9063
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9064
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9065
	 && __isSmallInteger(bgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9066
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9067
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9068
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9069
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9070
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9071
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9072
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9073
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9074
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9075
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9076
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9077
    "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
  9078
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9079
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9080
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9081
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9082
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9083
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9084
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9085
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9086
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9087
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9088
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9089
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9090
	    if (__isExternalAddress(aBitmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9091
		bitmap = __PixmapVal(aBitmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9092
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9093
		XSetStipple(dpy, gc, bitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9094
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9095
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9096
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9097
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9098
	    if (aBitmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9099
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9100
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9101
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9102
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9103
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9104
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9105
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9106
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9107
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9108
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9109
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  9110
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9111
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9112
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9113
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9114
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9115
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9116
    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
  9117
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9118
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9119
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9120
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9121
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9122
	    if (aBool == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9123
		gcv.subwindow_mode = ClipByChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9124
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9125
		gcv.subwindow_mode = IncludeInferiors;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9126
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9127
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9128
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9129
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9130
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9131
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9132
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9133
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9134
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9135
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9136
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  9137
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
  9138
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9139
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9140
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9141
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9142
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9143
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9144
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9145
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9146
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9147
	 && __bothSmallInteger(clipX, clipY)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9148
	 && __bothSmallInteger(clipWidth, clipHeight)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9149
	    r.x = __intVal(clipX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9150
	    r.y = __intVal(clipY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9151
	    r.width = __intVal(clipWidth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9152
	    r.height = __intVal(clipHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9153
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9154
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9155
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9156
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9157
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9158
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9159
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9160
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9161
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9162
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9163
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9164
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9165
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9166
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9167
%{
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9168
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9169
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9170
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9171
	 && __isSmallInteger(offset)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9172
	 && __isByteArrayLike(dashList)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9173
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9174
	    XSetDashes(myDpy, __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9175
		       __intVal(offset),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9176
		       __ByteArrayInstPtr(dashList)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9177
		       __byteArraySize(dashList));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9178
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9179
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9180
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9181
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9182
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9183
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9184
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9185
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9186
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9187
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9188
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9189
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9190
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  9191
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9192
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9193
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9194
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9195
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9196
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9197
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9198
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9199
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9200
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9201
	if (__isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9202
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9203
	    f = (XFontStruct *) __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9204
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9205
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9206
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9207
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9208
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9209
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9210
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9211
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9212
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9213
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9214
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9215
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9216
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9217
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9218
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9219
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9220
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9221
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9222
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9223
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9224
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9225
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9226
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9227
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9228
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9229
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9230
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9231
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9232
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9233
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9234
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9235
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9236
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9237
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9238
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9239
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9240
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9241
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9242
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9243
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9244
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9245
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9246
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9247
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9248
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9249
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9250
	 && __isSmallInteger(fgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9251
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9252
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9253
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9254
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9255
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9256
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9257
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9258
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9259
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9260
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9261
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9262
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9263
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9264
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9265
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9266
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9267
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9268
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9269
	if (__isExternalAddress(aGCId)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9270
	    GC gc = __GCVal(aGCId);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9271
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9272
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9273
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9274
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9275
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9276
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9277
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9278
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9279
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9280
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9281
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9282
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9283
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9284
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9285
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9286
	    if (fun != -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9287
		ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9288
		XSetFunction(myDpy, gc, fun);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9289
		LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9290
		RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9291
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9292
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9293
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9294
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9295
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9296
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9297
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9298
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9299
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9300
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9301
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9302
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9303
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9304
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9305
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9306
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9307
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9308
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9309
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9310
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9311
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9312
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9313
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9314
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9315
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9316
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9317
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9318
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9319
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9320
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9321
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9322
    "set line attributes;
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9323
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9324
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9325
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9326
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9327
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9328
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9329
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9330
    int x_style, x_cap, x_join;
6768
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9331
    static char dotList[2] = { 1,1 };
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9332
    static char dashList[2]  = { 4,4 };
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9333
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9334
    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
  9335
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9336
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9337
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9338
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9339
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9340
	 && __isSmallInteger(aNumber)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9341
	    Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9342
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9343
	    if (lineStyle == @symbol(solid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9344
		x_dashes = (char *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9345
		x_style = LineSolid;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9346
	    } else if (lineStyle == @symbol(dashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9347
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9348
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9349
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9350
	    } else if (lineStyle == @symbol(doubleDashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9351
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9352
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9353
		x_style = LineDoubleDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9354
	    } else if (lineStyle == @symbol(dotted)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9355
		x_dashes = dotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9356
		x_nDash = sizeof(dotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9357
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9358
	    } else if (lineStyle == @symbol(dashDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9359
		x_dashes = dashDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9360
		x_nDash = sizeof(dashDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9361
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9362
	    } else if (lineStyle == @symbol(dashDotDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9363
		x_dashes = dashDotDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9364
		x_nDash = sizeof(dashDotDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9365
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9366
	    } else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9367
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9368
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9369
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9370
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9371
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9372
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9373
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9374
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9375
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9376
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9377
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9378
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9379
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9380
	    if (x_dashes) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9381
		XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9382
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9383
	    XSetLineAttributes(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9384
			       __GCVal(aGCId), __intVal(aNumber),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9385
			       x_style, x_cap, x_join);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9386
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9387
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9388
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9389
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9390
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9391
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9392
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9393
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9394
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9395
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9396
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9397
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9398
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9399
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9400
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9401
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9402
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9403
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9404
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9405
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9406
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9407
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9408
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9409
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9410
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9411
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9412
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9413
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9414
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9415
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9416
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9417
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9418
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9419
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9420
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9421
    "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
  9422
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9423
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9424
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9425
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9426
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9427
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9428
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9429
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9430
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9431
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9432
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9433
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9434
	    if (__isExternalAddress(aPixmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9435
		pixmap = __PixmapVal(aPixmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9436
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9437
		XSetTile(dpy, gc, pixmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9438
		XSetFillStyle(dpy, gc, FillTiled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9439
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9440
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9441
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9442
	    if (aPixmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9443
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9444
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9445
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9446
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9447
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9448
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9449
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9450
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9451
    self primitiveFailedOrClosedConnection
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9452
!
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9453
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9454
setPlaneMask:bits in:aGCId
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9455
    "set foreground color to be drawn with"
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9456
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9457
    <context: #return>
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9458
%{
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9459
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9460
	if (__isExternalAddress(aGCId)
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9461
	 && __isSmallInteger(bits)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9462
	    unsigned long mask = __intVal(bits);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9463
	    if (__intVal(bits) == -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9464
		mask = AllPlanes;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9465
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9466
	    ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9467
	    XSetPlaneMask(myDpy, __GCVal(aGCId), mask);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9468
	    LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9469
	    RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9470
	}
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9471
    }
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9472
%}.
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9473
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9474
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9475
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  9476
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9477
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9478
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9479
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9480
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9481
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9482
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9483
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9484
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9485
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  9486
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9487
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9488
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9489
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9490
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9491
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9492
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9493
	XCloseDisplay(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9494
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9495
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9496
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9497
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9498
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9499
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9500
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9501
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9502
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9503
%{
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9504
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9505
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9506
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9507
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9508
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9509
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9510
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9511
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9512
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9513
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9514
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9515
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9516
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9517
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9518
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9519
getWindowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9520
    "Creates a fake WindowGroup view. This window is used
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9521
     in XWMHints & _NET_WM_LEADER properties to define
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9522
     application window group"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9523
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9524
    windowGroupWindow isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9525
	windowGroupWindow := WindowGroupWindow new create.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9526
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9527
    ^ windowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9528
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9529
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9530
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  9531
    activateOnClick := false.
6156
dd328de0a324 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6154
diff changeset
  9532
    maxOperationsUntilFlush := nil.
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  9533
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  9534
    super initializeDefaultValues.
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9535
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9536
    "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
  9537
    Even on 2-button mouse (button 2 is simply not reported).
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9538
    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
  9539
    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
  9540
    is somewhat special value.
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9541
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9542
    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
  9543
    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
  9544
7478
4865dd2c05c9 #OTHER by mawalch
mawalch
parents: 7443
diff changeset
  9545
    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
  9546
    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
  9547
    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
  9548
    "
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9549
6092
92572b3d40ea you shalt not modify literal arrays
Claus Gittinger <cg@exept.de>
parents: 6064
diff changeset
  9550
    buttonTranslation := buttonTranslation copy.
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9551
    buttonTranslation at: 2 put: #paste
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9552
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9553
    "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
  9554
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9555
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9556
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9557
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9558
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  9559
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  9560
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9561
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9562
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9563
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9564
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9565
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9566
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9567
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9568
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9569
     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
  9570
     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
  9571
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9572
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9573
    displayId notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9574
	"/ already connected - you bad guy try to trick me manually ?
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9575
	^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9576
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9577
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9578
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9579
    displayId isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9580
	"/ could not connect.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9581
	DeviceOpenErrorSignal raiseWith:aDisplayName.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9582
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9583
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9584
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9585
    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9586
    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  9587
    hasConnectionBroken := false.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9588
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9589
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9590
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9591
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9592
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9593
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9594
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9595
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9596
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9597
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9598
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9599
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9600
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9601
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9602
    atoms := nil.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9603
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9604
    "These values are initialized by primitive code in #createWindowFor:..."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9605
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9606
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9607
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9608
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9609
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9610
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9611
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9612
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9613
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9614
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9615
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9616
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9617
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9618
    Screen default isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9619
	"not initialized yet?"
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9620
	self initializeViewStyle.
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9621
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9622
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9623
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9624
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9625
    "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
  9626
     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
  9627
     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
  9628
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9629
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9630
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9631
    super initializeModifierMappings.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9632
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9633
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9634
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9635
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9636
    map isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9637
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9638
	"/ mhmh - a crippled Xlib which does not provide modifier mappings
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9639
	"/ setup some reasonable default. If that is not sufficient,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9640
	"/ you have to change things from your display.rc file.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9641
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9642
	altModifierMask := self modifier1Mask.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9643
	metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9644
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9645
	| mod symbolFromKeyCode nonNilOnes |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9646
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9647
	altModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9648
	metaModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9649
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9650
	symbolFromKeyCode := [:key | self symbolFromKeycode:key].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9651
	nonNilOnes := [:str | str notNil].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9652
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9653
	mod := map at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9654
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9655
	    shiftModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9656
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9657
	mod := map at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9658
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9659
	    ctrlModifiers  := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9660
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9661
	mod := map at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9662
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9663
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9664
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9665
		metaModifiers := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9666
		metaModifierMask := 1 bitShift:(4-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9667
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9668
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9669
	mod := map at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9670
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9671
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9672
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9673
		altModifiers   := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9674
		altModifierMask := 1 bitShift:(5-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9675
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9676
	]
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9677
    ].
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9678
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9679
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9680
     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
  9681
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9682
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9683
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9684
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9685
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9686
initializeScreenBounds
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9687
    self isOpen ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9688
	"queries answer nil if not open"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9689
	^ self.
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9690
    ].
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9691
    self isXineramaActive ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9692
	|rect|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9693
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9694
	self monitorBounds do:[:eachRect|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9695
	    rect isNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9696
		rect := eachRect.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9697
	    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9698
		rect := rect merge:eachRect.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9699
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9700
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9701
	width := rect width.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9702
	height := rect height.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9703
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9704
	"propagate possible size changes to our rootView"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9705
	rootView notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9706
	    rootView initialize.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9707
	].
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9708
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9709
	width := self queryWidth.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9710
	height := self queryHeight.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9711
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9712
    widthMM := self queryWidthMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9713
    heightMM := self queryHeightMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9714
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9715
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9716
      Display initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9717
    "
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9718
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9719
    "Modified (format): / 20-03-2018 / 12:18:31 / stefan"
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9720
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9721
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9722
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9723
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9724
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9725
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9726
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9727
    hasShapeExtension := self hasExtension:#SHAPE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9728
    hasShmExtension := self hasExtension:#MIT_SHM.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9729
    hasDPSExtension := self hasExtension:#DPS.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9730
    hasXVideoExtension := self hasExtension:#XVideo.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9731
    hasMbufExtension := self hasExtension:#'Multi-Buffering'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9732
    hasPEXExtension := self hasExtension:#'X3D-PEX'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9733
    hasImageExtension := self hasExtension:#XIE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9734
    hasInputExtension := self hasExtension:#XInputExtension.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9735
    hasXineramaExtension := self hasExtension:#XINERAMA.
8670
8c88b7868cde *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8669
diff changeset
  9736
    hasXTestExtension := self hasExtension:#XTEST.
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9737
    hasRenderExtension := self hasExtension:#RENDER.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9738
    hasXftLibrary := hasRenderExtension and:[self class hasXftLibrary].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9739
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9740
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9741
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9742
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9743
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9744
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9745
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9746
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9747
    screen := self queryDefaultScreen.
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9748
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9749
    self initializeScreenBounds.
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9750
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9751
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9752
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9753
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9754
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9755
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9756
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9757
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9758
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9759
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9760
    (visualType == #StaticGray
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9761
     or:[ visualType == #GrayScale]) ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9762
	hasColors := false.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9763
	monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9764
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9765
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9766
    ncells == 2 ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9767
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9768
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9769
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9770
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9771
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9772
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9773
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9774
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9775
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9776
    visualType == #TrueColor ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9777
	redShift := redMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9778
	greenShift := greenMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9779
	blueShift := blueMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9781
	bitsRed := redMask highBit - redMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9782
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9783
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9784
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9785
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  9786
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9787
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9788
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9789
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9790
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9791
    XVisualInfo viproto;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9792
    XVisualInfo *vip;                   /* returned info */
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9793
    int maxRGBDepth, maxRGBADepth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9794
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9795
    int rgbaRedMask, rgbaGreenMask, rgbaBlueMask, rgbaAlphaMask;
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9796
    int rgbVisualID, rgbaVisualID;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9797
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9798
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9799
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9800
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9801
    if (ISCONNECTED) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9802
	dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9803
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9804
	/*
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9805
	 * look for RGB visual with the highest depth
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9806
	 */
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9807
	nvi = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9808
	viproto.screen = scr;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9809
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9810
	maxRGBDepth = maxRGBADepth = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9811
	for (i = 0; i < nvi; i++) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9812
	    int thisDepth = vip[i].depth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9813
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9814
	    switch (vip[i].class) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9815
		case TrueColor:
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9816
		    if (thisDepth > maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9817
			if (thisDepth <= 24) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9818
			    maxRGBDepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9819
			    rgbRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9820
			    rgbGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9821
			    rgbBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9822
			    rgbVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9823
			} else {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9824
			    if (thisDepth > maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9825
				// printf("found rgba visual!\n");
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9826
				maxRGBADepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9827
				rgbaRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9828
				rgbaGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9829
				rgbaBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9830
				rgbaVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9831
			    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9832
			}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9833
		    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9834
		    break;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9835
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9836
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9837
	if (vip) XFree ((char *) vip);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9838
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9839
	if (maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9840
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9841
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9842
	if (maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9843
	    __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9844
	    if (!maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9845
		__INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9846
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9847
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9848
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9849
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9850
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9851
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9852
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9853
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9854
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9855
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9856
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9857
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9858
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9859
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9860
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9861
    (self serverVendor = 'X11/NeWS') ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9862
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9863
	"/ 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
  9864
	"/ which does not correctly handle saveUnder
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9865
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9866
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9867
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9868
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9869
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9870
initializeUniqueID
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9871
    uniqueDeviceID isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9872
	uniqueDeviceID := UUID genUUID.
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9873
    ]
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9874
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9875
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9876
invalidateConnection
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9877
    super invalidateConnection.
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9878
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9879
    "the new display may support a different set of fonts"
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9880
    self flushListOfAvailableFonts
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9881
!
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9882
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9883
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9884
    "open a connection to some display;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9885
     return the displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9886
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  9887
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9888
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9889
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9890
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9891
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  9892
    if (__isStringLike(dpyName))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9893
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9894
    else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9895
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9896
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9897
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9898
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9899
    if (dpy) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9900
	static int firstCall = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9901
	OBJ dpyID;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9902
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9903
	dpyID = __MKEXTERNALADDRESS(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9904
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9905
	if (firstCall) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9906
	    firstCall = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9907
	    XSetErrorHandler(__XErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9908
	    XSetIOErrorHandler(__XIOErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9909
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9910
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9911
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9912
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9913
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9914
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9915
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9916
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9917
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9918
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9919
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9920
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9921
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9922
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9923
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9924
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9925
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9926
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9927
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9928
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9929
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9930
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9931
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9932
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9933
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9934
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9935
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9936
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9937
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9938
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9939
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9940
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9941
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9942
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9943
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9944
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9945
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9946
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9947
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9948
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9949
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9950
     Display queryCells
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9951
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9952
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9953
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9954
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9955
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9956
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9957
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9958
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9959
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9960
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9961
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9962
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9963
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9964
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9965
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9966
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9967
     Display queryDefaultScreen
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9968
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9969
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9970
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9971
queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9972
%{  /* NOCONTEXT */
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9973
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9974
    if (ISCONNECTED) {
6762
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9975
	Display *dpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9976
	Visual *visual;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9977
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9978
	dpy = myDpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9979
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9980
	RETURN ( __MKEXTERNALADDRESS( visual ) );
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9981
    }
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9982
%}.
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9983
    ^ nil
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9984
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9985
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9986
     Display queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9987
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9988
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9989
    "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
  9990
!
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9991
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9992
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9993
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9994
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9995
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9996
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9997
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9998
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9999
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10000
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10001
	switch (visual->class) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10002
	    case StaticGray:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10003
		RETURN ( @symbol(StaticGray) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10004
	    case GrayScale:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10005
		RETURN ( @symbol(GrayScale) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10006
	    case StaticColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10007
		RETURN ( @symbol(StaticColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10008
	    case PseudoColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10009
		RETURN ( @symbol(PseudoColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10010
	    case TrueColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10011
		RETURN ( @symbol(TrueColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10012
	    case DirectColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10013
		RETURN ( @symbol(DirectColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10014
	}
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10015
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10016
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10017
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10018
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10019
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10020
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10021
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10022
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10023
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10024
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10025
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10026
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10027
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10028
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10029
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10030
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10031
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10032
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10033
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10034
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10035
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10036
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10037
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10038
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10039
     Display queryDepth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10040
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10041
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10042
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10043
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10044
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10045
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10046
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10047
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10048
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10049
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10050
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10051
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10052
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10053
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10054
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10055
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10056
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10057
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10058
     Display queryHeight
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10059
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10060
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10061
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10062
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10063
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10064
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10065
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10066
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10067
	int scr;
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10068
	int h;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10069
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10070
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10071
	scr = DefaultScreen(dpy);
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10072
	h = DisplayHeightMM(dpy, scr);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10073
	if (h == 0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10074
	    console_fprintf(stderr, "XWorkstation [warning]: invalid height - fixup\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10075
	    h = 250;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10076
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10077
	RETURN ( __MKSMALLINT(h));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10078
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10079
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10080
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10081
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10082
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10083
     Display queryHeightMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10084
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10085
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10086
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10087
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10088
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10089
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10090
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10091
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10092
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10093
	OBJ redMask, greenMask, blueMask, bprgb;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10094
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10095
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10096
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10097
	redMask   = __MKSMALLINT(visual->red_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10098
	greenMask = __MKSMALLINT(visual->green_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10099
	blueMask  = __MKSMALLINT(visual->blue_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10100
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10101
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10102
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10103
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10104
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10105
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10106
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10107
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10108
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10109
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10110
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10111
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10112
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10113
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10114
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10115
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10116
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10117
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10118
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10119
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10120
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10121
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10122
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10123
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10124
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10125
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10126
     Display queryWhitePixel
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10127
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10128
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10129
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10130
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10131
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10132
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10133
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10134
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10135
	int scr;
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
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10138
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10139
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10140
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10141
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10142
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10143
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10144
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10145
     Display queryWidth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10146
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10147
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10148
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10149
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10150
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10151
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10152
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10153
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10154
	int scr;
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10155
	int w;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10156
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10157
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10158
	scr = DefaultScreen(dpy);
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10159
	w = DisplayWidthMM(dpy, scr);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10160
	if (w == 0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10161
	    console_fprintf(stderr, "XWorkstation [warning]: invalid width - fixup\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10162
	    w = 250;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10163
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 10164
	RETURN ( __MKSMALLINT(w));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10165
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10166
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10167
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10168
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10169
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10170
     Display queryWidthMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10171
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10172
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
 10173
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10174
reinitialize
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10175
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10176
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10177
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10178
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10179
    virtualRootId := rootId := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10180
    selectionFetchers := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10181
    dispatchingExpose := nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10182
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10183
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10184
releaseDeviceResources
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10185
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10186
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10187
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10188
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10189
    selectionFetchers := nil.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10190
    super releaseDeviceResources.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10191
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10192
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10193
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10194
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10195
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10196
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10197
     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
 10198
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10199
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10200
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10201
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10202
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10203
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10204
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10205
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10206
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10207
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10208
     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
 10209
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10210
     and the setting can be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10211
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10212
     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
 10213
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10214
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10215
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10216
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10217
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10218
appleAltModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10219
    "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
 10220
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10221
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10222
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10223
	^ 8192
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10224
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10225
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10226
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10227
    "Created: / 10-02-2017 / 21:32:13 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10228
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10229
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10230
appleCmdModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10231
    "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
 10232
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10233
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10234
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 10235
	^ 16
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10236
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10237
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10238
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10239
    "Created: / 10-02-2017 / 21:32:50 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10240
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
 10241
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10242
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10243
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10244
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10245
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10246
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10247
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10248
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10249
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10250
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10251
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10252
     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
 10253
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10254
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10255
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10256
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10257
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10258
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10259
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10260
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10261
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10262
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10263
     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
 10264
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10265
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10266
     be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10267
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10268
     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
 10269
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10270
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10271
     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
 10272
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10273
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10274
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10275
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10276
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10277
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10278
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10279
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10280
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10281
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10282
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10283
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10284
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10285
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10286
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10287
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10288
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10289
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10290
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10291
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10292
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10293
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10294
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10295
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10296
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10297
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10298
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10299
    "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
 10300
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10301
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10302
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10303
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10304
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10305
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10306
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10307
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10308
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10309
    "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
 10310
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10311
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10312
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10313
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10314
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10315
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10316
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10317
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10318
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10319
    "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
 10320
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10321
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10322
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10323
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10324
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10325
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10326
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10327
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10328
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10329
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10330
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10331
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10332
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10333
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10334
    modifierKeyMap := self rawModifierMapping.
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
 10335
    modifierKeyMap isEmptyOrNil ifTrue:[^ nil].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10336
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10337
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10338
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10339
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10340
    1 to:8 do:[ :i |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10341
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10342
	    |mod|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10343
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10344
	    mod := OrderedCollection new:maxKeyPerMod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10345
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10346
		key ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10347
		    mod add:key
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10348
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10349
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10350
	    ret at:i put:mod asArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10351
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10352
	nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10353
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10354
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10355
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10356
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10357
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10358
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10359
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10360
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10361
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10362
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10363
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10364
     mapping := Display modifierMapping.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10365
     ^ mapping collect:[:eachRow |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10366
			     eachRow notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10367
				 eachRow collect:[ :key | Display stringFromKeycode:key ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10368
			     ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10369
				 nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10370
			     ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10371
		       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10372
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10373
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10374
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10375
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10376
    "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
 10377
     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
 10378
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10379
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10380
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10381
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10382
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10383
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10384
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10385
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10386
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10387
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10388
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10389
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
 10390
    |modifierKeyMap|
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10391
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10392
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10393
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10394
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10395
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10396
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10397
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10398
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10399
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10400
	   if (modifierKeyMap != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10401
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10402
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10403
	   }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10404
	   XFreeModifiermap(modmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10405
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10406
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10407
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10408
    ^ modifierKeyMap
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10409
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10410
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10411
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10412
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10413
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10414
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10415
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10416
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10417
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10418
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10419
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10420
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10421
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10422
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10423
superModifierMask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10424
    "return the Xlib mask bit for the super modifier key"
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10425
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10426
    ^ self modifier4Mask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10427
!
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10428
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10429
symbolFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10430
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10431
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10432
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10433
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10434
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10435
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10436
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10437
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10438
    if (ISCONNECTED && __isSmallInteger(code)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10439
	Display *dpy = myDpy;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10440
5983
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10441
// Our Windows Xlib does not support Xkb as of 2013-01
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10442
//        if ((keysym = XkbKeycodeToKeysym(dpy, __intVal(code), 0, 0)) != NoSymbol
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10443
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10444
	    && (keystring = XKeysymToString(keysym)) != 0)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10445
	    str = __MKSYMBOL(keystring, 0);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10446
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10447
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10448
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10449
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10450
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10451
	Display symbolFromKeycode:50
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10452
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10453
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10454
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10455
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10456
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10457
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10458
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10459
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10460
    UserPreferences current beepEnabled ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10461
	self beep:0 volume:50.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10462
	self flush
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
 10463
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10464
6758
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10465
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10466
     Screen current beep
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10467
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10468
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10469
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10470
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10471
5247
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10472
beep:aSymbolOrInteger volume:volumeInPercent
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10473
    "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
 10474
     (kept for comaptibilty with WinWorkstation)."
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10475
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10476
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10477
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10478
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10479
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10480
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10481
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10482
	/* stupid: X wants -100 .. 100 and calls this percent */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10483
	volume = __intVal(volumeInPercent) * 2 - 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10484
	if (volume < -100) volume = -100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10485
	else if (volume > 100) volume = 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10486
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10487
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10488
	XBell(myDpy, volume);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10489
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10490
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10491
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10492
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10493
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10494
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10495
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10496
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10497
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10498
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10499
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10500
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10501
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10502
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10503
	XSynchronize(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10504
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10505
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10506
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10507
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10508
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10509
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10510
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10511
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10512
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10513
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10514
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10515
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10516
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10517
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10518
     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
 10519
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10520
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10521
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10522
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10523
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10524
	XFlush(myDpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10525
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10526
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10527
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10528
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10529
    operationsUntilFlush := maxOperationsUntilFlush.
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10530
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10531
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10532
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10533
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10534
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10535
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10536
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10537
	&& __isExternalAddress(aDPSContext)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10538
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10539
	DPSFlushContext(__DPSContextVal(aDPSContext));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10540
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10541
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10542
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10543
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10544
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10545
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10546
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10547
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10548
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10549
flushIfAppropriate
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10550
    "flush the device, if necessary"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10551
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10552
    operationsUntilFlush notNil ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10553
	operationsUntilFlush <= 0 ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10554
	    self flush.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10555
	    ^ true.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10556
	] ifFalse:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10557
	    operationsUntilFlush := operationsUntilFlush - 1.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10558
	].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10559
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10560
    ^ false.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10561
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10562
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10563
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10564
    "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
 10565
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10566
     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
 10567
     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
 10568
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10569
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10570
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10571
%{
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10572
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10573
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10574
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10575
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10576
	XSync(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10577
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10578
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10579
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10580
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10581
    operationsUntilFlush := maxOperationsUntilFlush.
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10582
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10583
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10584
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10585
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10586
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10587
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10588
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10589
    if (ISCONNECTED && __isByteArrayLike(eB)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10590
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10591
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10592
	XRefreshKeyboardMapping(ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10593
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10594
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10595
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10596
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10597
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10598
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10599
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10600
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10601
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10602
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10603
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10604
    self sync.
4119
a770b7e08c72 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4114
diff changeset
 10605
    ^ Timestamp millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10606
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10607
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10608
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10609
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10610
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10611
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10612
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10613
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10614
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10615
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10616
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10617
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10618
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10619
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10620
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10621
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10622
     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
 10623
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10624
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10625
     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
 10626
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10627
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10628
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10629
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10630
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10631
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10632
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10633
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10634
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10635
	    focusWindow = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10636
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10637
	    focusWindow = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10638
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10639
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10640
	if (revertSymbol == @symbol(parent))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10641
	    arg = RevertToParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10642
	else if (revertSymbol == @symbol(root))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10643
	    arg = RevertToPointerRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10644
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10645
	    arg = RevertToNone;
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10648
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10649
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10650
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10651
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10652
	RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10653
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10654
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10655
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10656
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10657
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10658
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10659
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10660
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10661
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10662
     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
 10663
     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
 10664
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10665
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10666
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10667
    self dispatchPendingEvents.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10668
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10669
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10670
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10671
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10672
     This makes all graphics synchronous and turns off any buffering
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10673
     (i.e. each individual draw-request is sent immediately without
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10674
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10675
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10676
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10677
     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
 10678
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10679
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10680
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10681
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10682
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10683
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10684
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10685
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10686
	XSynchronize(myDpy, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10687
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10688
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10689
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10690
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10691
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10692
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10693
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10694
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10695
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10696
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10697
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10698
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10699
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10700
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10701
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
 10702
    ^ self buttonMotionMask:#all
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10703
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10704
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10705
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10706
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10707
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10708
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10709
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10710
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10711
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10712
     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
 10713
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10714
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10715
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10716
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10717
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10718
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10719
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10720
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10721
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10722
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10723
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10724
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10725
	w = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10726
	if (w) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10727
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10728
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10729
	    XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10730
				 &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10731
				 &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10732
				 &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10733
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10734
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10735
	    RETURN (__MKSMALLINT(mask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10736
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10737
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10738
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10739
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10740
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10741
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10742
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10743
     Display buttonStates
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10744
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10745
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10746
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10747
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10748
     Display buttonStates bitTest:(Display controlMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10749
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10750
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10751
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10752
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10753
     Display buttonStates bitTest:(Display altModifierMask)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10754
     Display buttonStates bitTest:(Display metaModifierMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10755
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10756
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10757
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10758
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10759
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10760
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10761
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
 10762
    ^ self button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10763
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10764
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10765
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10766
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10767
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10768
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10769
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10770
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
 10771
    ^ self button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10772
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10773
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10774
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10775
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10776
pointerPosition
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10777
    "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
 10778
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10779
    <context: #return>
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10780
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10781
    |xpos ypos rootWindowId|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10782
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10783
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10784
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10785
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10786
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10787
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10788
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10789
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10790
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10791
    if (ISCONNECTED && rootWindowId != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10792
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10793
	Window w = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10794
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10795
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10796
	XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10797
			      &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10798
			      &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10799
			      &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10800
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10801
	xpos = __MKSMALLINT(rootX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10802
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10803
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10804
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10805
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10806
    xpos isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10807
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10808
	^ nil
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10809
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10810
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10811
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10812
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10813
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10814
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10815
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10816
8669
969a9b666cd3 refactoring & XTest extension
Claus Gittinger <cg@exept.de>
parents: 8655
diff changeset
 10817
    ^ self button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10818
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10819
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10820
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10821
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10822
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10823
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10824
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10825
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10826
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10827
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10828
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10829
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10830
    "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
 10831
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
 10832
     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
 10833
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10834
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10835
     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
 10836
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10837
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10838
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10839
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10840
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10841
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10842
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10843
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10844
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10845
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10846
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10847
     && __bothSmallInteger(xpos, ypos)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10848
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10849
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10850
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10851
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10852
	XWarpPointer(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10853
		     None,  /* src window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10854
		     w,  /* dst window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10855
		     0,  /* src_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10856
		     0,  /* src_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10857
		     0,  /* src_w */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10858
		     0,  /* src_h */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10859
		     __intVal(xpos),  /* dst_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10860
		     __intVal(ypos)   /* dst_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10861
		    );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10862
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10863
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10864
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10865
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10866
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10867
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10868
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10869
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10870
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10871
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10872
!XWorkstation methodsFor:'private'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10873
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10874
addSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10875
    "register someone to be notified when the selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10876
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10877
    selectionHandlers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10878
	selectionHandlers := IdentitySet new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10879
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10880
    selectionHandlers add:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10881
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10882
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10883
findSelectionFetcher:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10884
    "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
 10885
     Answer nil, if there is none"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10886
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10887
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10888
	^ nil.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10889
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10890
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10891
    ^ selectionFetchers at:aDrawableId ifAbsent:[].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10892
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10893
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10894
registerSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10895
    "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
 10896
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10897
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10898
	selectionFetchers := Dictionary new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10899
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10900
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10901
    selectionFetchers at:aSelectionFetcher drawableID put:aSelectionFetcher.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10902
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10903
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10904
removeSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10905
    "no longer tell someone about selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10906
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10907
    selectionHandlers notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10908
	selectionHandlers remove:someone ifAbsent:nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10909
	selectionHandlers := selectionHandlers asNilIfEmpty
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10910
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10911
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10912
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10913
unregisterSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10914
    "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
 10915
8053
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10916
    selectionFetchers removeKey:(aSelectionFetcher drawableID) ifAbsent:[].
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10917
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10918
    "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
 10919
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10920
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10921
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10922
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10923
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10924
    "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
 10925
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10926
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10927
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10928
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10929
    if (ISCONNECTED && __isAtomID(propertyID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10930
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10931
	Atom prop;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10932
	Window window;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10933
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10934
	prop = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10935
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10936
	if (__isExternalAddress(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10937
	    window = __WindowVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10938
	} else if (aWindowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10939
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10940
	} else if (__isInteger(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10941
	    window = (Window)__unsignedLongIntVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10942
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10943
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10944
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10945
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10946
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10947
	XDeleteProperty(dpy, window, prop);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10948
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10949
	RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10950
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10951
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10952
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10953
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10954
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10955
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10956
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10957
    "get a property as an association propertyType->propertyValue"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10958
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10959
    |val propertyAtomID association windowIDOrNil|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10960
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10961
    propertySymbolOrAtomID isString ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10962
	propertyAtomID := self atomIDOf:propertySymbolOrAtomID create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10963
	propertyAtomID isNil ifTrue:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10964
	    "The propertyAtom does not even exist"
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10965
	    ^ nil
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10966
	].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10967
    ] ifFalse:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10968
	propertyAtomID := propertySymbolOrAtomID.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10969
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10970
    aWindowOrWindowIDOrNil isView ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10971
	windowIDOrNil := aWindowOrWindowIDOrNil drawableId.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10972
    ] ifFalse:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10973
	windowIDOrNil := aWindowOrWindowIDOrNil.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10974
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10975
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10976
    association := self primGetProperty:propertyAtomID from:windowIDOrNil delete:doDelete.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10977
    association isNil ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10978
	"The property does not exist in the specified window"
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10979
	^ nil
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10980
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10981
    val := association value.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10982
    (val isByteArray and:[association key = (self atomIDOf:#'UTF8_STRING' create:true)]) ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10983
	val := val utf8Decoded.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10984
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10985
    (val isString and:[val includes:(Character codePoint:0)]) ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10986
	val := val asCollectionOfSubCollectionsSeparatedBy:(Character codePoint:0).
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10987
    ].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10988
    association value:val.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10989
    ^ association
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10990
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10991
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10992
     Display
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10993
	getProperty:#'_NET_DESKTOP_NAMES'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10994
	from:nil
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10995
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10996
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10997
     Display
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10998
	getProperty:#'_NET_CURRENT_DESKTOP'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 10999
	from:nil
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11000
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11001
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11002
     Display
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11003
	getProperty:#'_NET_WM_ALLOWED_ACTIONS'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11004
	from:Transcript
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11005
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11006
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11007
     Display
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11008
	getProperty:#'_NET_SUPPORTED'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11009
	from:nil
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11010
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11011
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11012
     Transcript showCR:(
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11013
	 (Display
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11014
	    getProperty:#'_NET_SUPPORTED'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11015
	    from:nil
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11016
	    delete:false) value
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11017
		    collect:[:eachID | Display atomName:eachID])
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11018
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11019
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11020
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11021
    "Modified: / 31-08-2017 / 22:01:44 / cg"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11022
    "Modified: / 26-04-2018 / 10:58:21 / stefan"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11023
    "Modified (comment): / 30-10-2018 / 20:43:11 / Claus Gittinger"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11024
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11025
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11026
primGetProperty:propertyAtomID from:aWindowIDOrNil delete:doDelete
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11027
    "get a property as an association propertyType->propertyValue"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11028
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11029
    <context: #return>
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11030
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11031
    |val typeID|
8341
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 11032
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 11033
%{  /* UNLIMITEDSTACK */
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11034
// #define PROPERTY_DEBUG
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11035
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11036
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11037
    Atom actual_type;
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11038
    int actual_format;
8341
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 11039
    unsigned long nread = 0, bytes_after;
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 11040
    char *cp = 0, *cp2;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11041
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11042
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11043
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11044
    if (ISCONNECTED) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11045
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11046
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11047
	if (__isAtomID(propertyAtomID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11048
	    property = __AtomVal(propertyAtomID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11049
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11050
	    if (__isExternalAddress(aWindowIDOrNil)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11051
		window = __WindowVal(aWindowIDOrNil);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11052
	    } else if (aWindowIDOrNil == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11053
		window = DefaultRootWindow(dpy);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11054
	    } else
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11055
		goto fail;
8341
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 11056
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 11057
#ifdef PROPERTY_DEBUG
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11058
	    console_fprintf(stderr, "getProperty %x\n", property);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11059
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11060
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11061
	    do {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11062
		int retVal;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11063
		unsigned char *data;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11064
		unsigned long nitems, nReturnedBytes;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11065
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11066
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11067
		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11068
					    doDelete == true,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11069
					    AnyPropertyType, &actual_type, &actual_format,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11070
					    &nitems, &bytes_after, (unsigned char **)&data);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11071
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11072
		if (retVal != Success) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 11073
#ifdef PROPERTY_DEBUG
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11074
		    console_fprintf(stderr, "- no success\n");
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11075
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11076
		    ok = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11077
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11078
		}
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 11079
#ifdef PROPERTY_DEBUG
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11080
		console_fprintf(stderr, "- type:%x format:%d nitems:%d bytes_after:%d\n", actual_type, actual_format, nitems, bytes_after);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11081
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11082
		if (actual_type == None) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11083
		    // The property does not exist in the specified window
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11084
		    ok = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11085
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11086
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11087
		typeID = __MKATOMOBJ(actual_type);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11088
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11089
		nReturnedBytes = nitems * (actual_format == 32 ? sizeof(long) : actual_format / 8);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11090
		if (! cp) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11091
		    cp = cp2 = (char *)malloc(nReturnedBytes+bytes_after);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11092
		    if (! cp) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11093
			XFree(data);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11094
			goto fail;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11095
		    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11096
		} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11097
		    cp2 = cp + nread;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11098
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11099
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11100
		nread += nReturnedBytes;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11101
		memcpy(cp2, data, nReturnedBytes);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11102
		XFree(data);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11103
	    } while (bytes_after > 0);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11104
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11105
	    if (ok) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11106
		switch (actual_format) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11107
		case 32:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11108
		    // bad design: even though it says "32",
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11109
		    // what is really returned are longs.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11110
		    // this does make a difference on 64bit machines!
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11111
		    val = __stArrayFromCULongArray((unsigned long*)cp, nread/sizeof(long));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11112
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11113
		case 16:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11114
		    val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11115
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11116
		case 8:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11117
		default:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11118
		    if (actual_type == XA_STRING) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11119
			val = __MKSTRING_L(cp, nread);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11120
		    } else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11121
			val = __MKBYTEARRAY(cp, nread);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11122
		    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11123
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11124
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11125
		if (cp) free(cp);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11126
		goto done;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11127
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11128
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11129
    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11130
fail:
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11131
    if (cp) free(cp);
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11132
    RETURN(nil);
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11133
done:;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11134
%}.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11135
    ^ typeID->val
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
 11136
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11137
    "Created: / 25-04-2018 / 16:41:52 / stefan"
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11138
    "Modified: / 27-04-2018 / 11:40:05 / stefan"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11139
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11140
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11141
primSetProperty:propertyID type:typeID value:anObject for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11142
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11143
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11144
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11145
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11146
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11147
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11148
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11149
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11150
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11151
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11152
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11153
	Atom prop, type;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11154
	Window window;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11155
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11156
	prop = __AtomVal(propertyID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11157
	type = __AtomVal(typeID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11158
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11159
	if (__isExternalAddress(aWindowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11160
	    window = __WindowVal(aWindowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11161
	} else if (aWindowID == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11162
	    window = DefaultRootWindow(dpy);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11163
	} else if (__isInteger(aWindowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11164
	    window = (Window)__unsignedLongIntVal(aWindowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11165
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11166
	    RETURN(false);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11167
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11168
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11169
	retval = true;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11170
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11171
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11172
	if (__isInteger(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11173
	    unsigned INT value = __longIntVal(anObject);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11174
	    XChangeProperty(dpy, window, prop, type, 32,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11175
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11176
			    (unsigned char *)&value, 1);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11177
	} else if (__isByteArrayLike(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11178
	    XChangeProperty(dpy, window, prop, type, 8,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11179
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11180
			    __byteArrayVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11181
			    __byteArraySize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11182
	} else if (__isWords(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11183
	    /* wordArray-like (16bit-string) object */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11184
	    XChangeProperty(dpy, window, prop, type, 16,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11185
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11186
			    __stringVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11187
			    __wordArraySize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11188
	} else if (__isIntegerArray(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11189
	    /* array of atoms */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11190
	    XChangeProperty(dpy, window, prop, type, 32,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11191
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11192
			    (char *)__integerArrayVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11193
			    __integerArraySize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11194
	} else if (__isStringLike(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11195
	    XChangeProperty(dpy, window, prop, type, 8,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11196
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11197
			    __stringVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11198
			    __stringSize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11199
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11200
	    retval = false;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11201
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11202
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11203
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11204
	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
 11205
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11206
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11207
    ^ retval
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11208
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11209
    "Created: / 26-04-2018 / 10:36:50 / stefan"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11210
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11211
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11212
propertiesOf:aWindowOrWindowIDOrNil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11213
    "return a collection of all properties' atomIDs of a window.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11214
     Returns the rootWindows props for a nil window argument."
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11215
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11216
    <context: #return>
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11217
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11218
    |windowID propertyAtoms|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11219
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11220
    aWindowOrWindowIDOrNil isView ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11221
	windowID := aWindowOrWindowIDOrNil drawableId.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11222
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11223
	windowID := aWindowOrWindowIDOrNil.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11224
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11225
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11226
%{
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11227
    Window window;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11228
    Atom *atomListPtr;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11229
    int i;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11230
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11231
    if (ISCONNECTED) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11232
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11233
	int numProps = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11234
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11235
	if (__isExternalAddress(windowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11236
	    window = __WindowVal(windowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11237
	} else if (windowID == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11238
	    window = DefaultRootWindow(dpy);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11239
	} else if (__isInteger(windowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11240
	    window = (Window)__unsignedLongIntVal(windowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11241
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11242
	    goto fail;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11243
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11244
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11245
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11246
	atomListPtr = XListProperties(dpy, window, &numProps);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11247
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11248
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11249
	if (atomListPtr == NULL) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11250
	    RETURN (nil);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11251
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11252
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11253
	propertyAtoms = __ARRAY_NEW_INT(numProps);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11254
	if (propertyAtoms == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11255
	    goto fail;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11256
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11257
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11258
	for (i=0; i<numProps; i++) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11259
	    OBJ atm;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11260
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11261
	    atm = __MKATOMOBJ(atomListPtr[i]);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11262
	    __ArrayInstPtr(propertyAtoms)->a_element[i] = atm; __STORE(propertyAtoms, atm);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11263
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11264
	XFree(atomListPtr);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11265
	RETURN (propertyAtoms);
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11266
    }
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11267
fail: ;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11268
%}.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11269
    ^ self primitiveFailed
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11270
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11271
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11272
     Display propertiesOf:nil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11273
     Display propertiesOf:Transcript id
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11274
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11275
     (Display propertiesOf:nil) collect:[:eachID | Display atomName:eachID]
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11276
     (Display propertiesOf:Transcript id) collect:[:eachID | Display atomName:eachID]
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11277
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11278
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11279
    "Modified: / 26-04-2018 / 11:00:12 / stefan"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11280
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11281
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11282
setIcon:anIcon for:aWindowOrWindowID
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11283
    |buffer iWidth iHeight|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11284
8562
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11285
    self assert:(anIcon depth == 32).
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11286
    self assert:(anIcon photometric == #argb).
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11287
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11288
    iWidth  := anIcon width.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11289
    iHeight := anIcon height.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11290
    buffer := IntegerArray new:(iWidth*iHeight+2).
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11291
    buffer at:1 put:iWidth.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11292
    buffer at:2 put:iHeight.
8562
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11293
    buffer replaceFrom:3 with:anIcon bits startingAt:1.
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11294
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11295
    self
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11296
	setProperty:#'_NET_WM_ICON'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11297
	type:#CARDINAL
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11298
	value:buffer
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11299
	for:aWindowOrWindowID
8562
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11300
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11301
    "
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11302
     Display setIcon:0 for:Transcript
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11303
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11304
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11305
    "Modified (comment): / 26-04-2018 / 10:59:17 / stefan"
8562
6a0b4f5f2f63 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 8475
diff changeset
 11306
    "Modified: / 30-10-2018 / 12:39:53 / Claus Gittinger"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11307
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11308
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11309
setProperty:propertySymbolOrAtomID type:typeSymbolOrAtomID value:anObject for:aWindowOrWindowIDOrNil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11310
    "set a property in the XServer"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11311
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11312
    |propertyAtomID typeAtomID windowIDOrNil|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11313
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11314
    propertySymbolOrAtomID isString ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11315
	propertyAtomID := self atomIDOf:propertySymbolOrAtomID create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11316
	propertyAtomID isNil ifTrue:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11317
	    "/ the property atom does not exist
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11318
	    Logger info:'property ATOM does not exist: %1' with:propertySymbolOrAtomID.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11319
	    ^ false
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11320
	].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11321
    ] ifFalse:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11322
	propertyAtomID := propertySymbolOrAtomID.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11323
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11324
    typeSymbolOrAtomID isString ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11325
	typeAtomID := self atomIDOf:typeSymbolOrAtomID create:false.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11326
	typeAtomID isNil ifTrue:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11327
	    "/ the type atom does not exist
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11328
	    Logger info:'type ATOM does not exist: %1' with:typeSymbolOrAtomID.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11329
	    ^ false
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11330
	].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11331
    ] ifFalse:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11332
	typeAtomID := typeSymbolOrAtomID.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11333
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11334
    aWindowOrWindowIDOrNil isView ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11335
	windowIDOrNil := aWindowOrWindowIDOrNil drawableId.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11336
    ] ifFalse:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11337
	windowIDOrNil := aWindowOrWindowIDOrNil.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11338
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11339
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11340
    ^ self primSetProperty:propertyAtomID type:typeAtomID value:anObject for:windowIDOrNil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11341
8347
33f968a33916 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8346
diff changeset
 11342
    "Modified: / 27-04-2018 / 12:20:46 / stefan"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11343
    "Modified: / 30-10-2018 / 20:44:55 / Claus Gittinger"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11344
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11345
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11346
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11347
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11348
defaultExtentForTopViews
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11349
    "redefined, to define the default extent for the default monitor"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11350
    |extent|
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11351
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11352
    "the standard monitor is the first entry in monitorBounds"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11353
    extent := self monitorBounds first extent.
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11354
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11355
    self isPDA ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11356
	^ extent - (16 @ 20)
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11357
    ].
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11358
    ^ extent * 2 // 3
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11359
!
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11360
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11361
isOpen
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11362
    "answer true, if device can be used"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11363
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11364
    ^ displayId notNil and:[hasConnectionBroken not].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11365
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11366
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11367
isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11368
%{  /* NOCONTEXT */
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11369
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11370
#ifdef XINERAMA
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11371
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11372
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11373
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11374
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11375
	if (XineramaIsActive(dpy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11376
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11377
	}
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11378
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11379
#endif
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11380
%}.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11381
    ^ false
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11382
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11383
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11384
     Display isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11385
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11386
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11387
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11388
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11389
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11390
atomIDOf:aStringOrSymbol
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11391
    "return an X11 atom's ID.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11392
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11393
     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
 11394
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11395
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11396
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11397
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11398
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11399
     Display atomIDOf:#'FACE_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11400
     Display atomIDOf:#'FULL_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11401
     Display atomIDOf:#DndProtocol
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11402
     Display atomIDOf:#DndSelection
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11403
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11404
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11405
    "Modified: / 04-04-1997 / 13:38:48 / cg"
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11406
    "Modified (comment): / 30-10-2018 / 20:45:47 / Claus Gittinger"
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11407
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11408
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11409
atomIDOf:aStringOrSymbol create:create
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11410
    "return an Atom's ID, given its name.
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11411
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11412
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11413
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11414
     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
 11415
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11416
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11417
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11418
    atomSymbol := aStringOrSymbol asSymbol.
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
 11419
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:[nil]) notNil]) ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11420
	^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11421
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11422
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11423
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11424
    atom notNil ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11425
	atoms isNil ifTrue:[
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11426
	    atoms := IdentityDictionary new.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11427
	].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 11428
	atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11429
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11430
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11431
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11432
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11433
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11434
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11435
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11436
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11437
     Display atomIDOf:'PRIMARY' create:false
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11438
     Display atomIDOf:'blabla' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11439
    "
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11440
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 11441
    "Modified (comment): / 30-10-2018 / 20:45:42 / Claus Gittinger"
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11442
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11443
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11444
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11445
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11446
     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
 11447
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11448
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11449
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11450
%{
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11451
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11452
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11453
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11454
    if (ISCONNECTED && __isAtomID(anAtomID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11455
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11456
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11457
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11458
	if (name == 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11459
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11460
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11461
	str = __MKSTRING(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11462
	XFree(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11463
	RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11464
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11465
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11466
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11467
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11468
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11469
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11470
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11471
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11472
     Display atomName:132  'FONTNAME_REGISTRY'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11473
     Display atomName:135 'FOUNDRY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11474
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11475
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11476
     Display atomName:152 'CHARSET_ENCODING'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11477
     Display atomName:154
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11478
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11479
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11480
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11481
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11482
    "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
 11483
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11484
     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
 11485
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11486
     Notice:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11487
	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
 11488
	styles or resources. This would make porting of applications
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11489
	to different platforms much more difficult (Windows has no resource
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11490
	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
 11491
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11492
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11493
     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
 11494
     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
 11495
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11496
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11497
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11498
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11499
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11500
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11501
     && __isStringLike(name)
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11502
     && __isStringLike(cls)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11503
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11504
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11505
				  (char *) __stringVal(name));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11506
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11507
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11508
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11509
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11510
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11511
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11512
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11513
    "if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11514
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11515
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11516
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11517
	 Display getResource:'Beep' class:'OpenWindows'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11518
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11519
     if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11520
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11521
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11522
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11523
	 Display getResource:'beNiceToColormap' class:'any'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11524
	 Display getResource:'beNiceToColormap' class:''
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11525
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11526
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11527
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11528
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11529
    "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
 11530
     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
 11531
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11532
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11533
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11534
%{
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11535
    Atom prop;
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
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11538
     && __isStringLike(aStringOrSymbol)) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11539
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11540
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11541
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11542
				  (create == true) ? False : True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11543
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11544
	if (prop == None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11545
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11546
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11547
	RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11548
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11549
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11550
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11551
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11552
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11553
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11554
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11555
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11556
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11557
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11558
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11559
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11560
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11561
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11562
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
 11563
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
 11564
    "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
 11565
     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
 11566
     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
 11567
     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
 11568
     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
 11569
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11570
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11571
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11572
    ((w <= 0) or:[h <= 0]) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11573
	self primitiveFailed.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11574
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11575
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11576
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11577
    rawInfo := Array new:8.
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11578
		  "1 -> bit order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11579
		  "2 -> depth"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11580
		  "3 -> bytes_per_line"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11581
		  "4 -> byte_order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11582
		  "5 -> format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11583
		  "6 -> bitmap_unit"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11584
		  "7 -> bitmap_pad"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11585
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11586
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11587
    "/ 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
 11588
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11589
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11590
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11591
    (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
 11592
	info := IdentityDictionary new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11593
	info at:#bitOrder put:(rawInfo at:1).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11594
	info at:#depth put:(rawInfo at:2).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11595
	info at:#bytesPerLine put:(rawInfo at:3).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11596
	info at:#byteOrder put:(rawInfo at:4).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11597
	info at:#format put:(rawInfo at:5).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11598
	info at:#bitmapUnit put:(rawInfo at:6).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11599
	info at:#bitmapPad put:(rawInfo at:7).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11600
	info at:#bitsPerPixel put:(rawInfo at:8).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11601
	^ info
7506
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11602
    ].
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11603
    "
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11604
     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
 11605
     or is too small to hold the bits
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.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11608
    ^ nil
295
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
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
 11611
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
 11612
    "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
 11613
     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
 11614
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11615
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11616
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11617
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11618
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11619
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11620
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11621
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11622
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11623
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11624
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11625
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11626
	win = __WindowVal(aDrawableId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11627
	xpos = __intVal(x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11628
	ypos = __intVal(y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11629
	if ((xpos < 0) || (ypos < 0)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11630
	    RETURN ( __MKSMALLINT(0) );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11631
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11632
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11633
	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, ~(unsigned long)0, ZPixmap);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11634
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11635
	if (img != 0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11636
	    ret = XGetPixel(img, 0, 0);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11637
	    XDestroyImage(img);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11638
	    RETURN (  __MKSMALLINT(ret) );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11639
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11640
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11641
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11642
    ^ nil
8367
e0d6816f072b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8358
diff changeset
 11643
e0d6816f072b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8358
diff changeset
 11644
    "Modified: / 17-05-2018 / 16:45:34 / Stefan Vogel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11645
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11646
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11647
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
 11648
    "since XGetImage may allocate huge amount of stack space
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11649
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11650
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11651
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11652
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11653
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11654
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11655
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11656
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11657
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11658
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11659
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11660
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11661
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11662
     && __bothSmallInteger(w, h)
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11663
     && __isArray(info) && (__arraySize(info) >= 8)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11664
     && __isByteArray(imageBits)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11665
	Display *dpy = myDpy;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11666
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11667
	win = __WindowVal(aDrawableId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11668
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11669
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11670
				    __intVal(w), __intVal(h),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11671
				    (unsigned long)AllPlanes, ZPixmap);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11672
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11673
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11674
	if (! image) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11675
	    RETURN ( false );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11676
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11677
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11678
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11679
#ifdef SUPERDEBUG
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11680
	console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11681
#endif
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11682
	switch (image->depth) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11683
	    case 1:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11684
	    case 2:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11685
	    case 4:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11686
	    case 8:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11687
	    case 16:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11688
	    case 24:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11689
	    case 32:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11690
		numBytes = image->bytes_per_line * image->height;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11691
		break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11692
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11693
	    default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11694
		/* unsupported depth ? */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11695
		console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11696
		numBytes = image->bytes_per_line * image->height;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11697
		break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11698
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11699
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11700
#ifdef SUPERDEBUG
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11701
	console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11702
#endif
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11703
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11704
	if (numBytes > __byteArraySize(imageBits)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11705
	    /* imageBits too small */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11706
	    console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11707
	    console_fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11708
	    console_fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n",
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11709
				image->bitmap_pad, image->depth, image->bytes_per_line);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11710
	    goto fail;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11711
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11712
	if (image->bitmap_bit_order == MSBFirst)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11713
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11714
	else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11715
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11716
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11717
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11718
	if (image->byte_order == MSBFirst)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11719
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11720
	else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11721
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11722
	if (image->format == XYBitmap)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11723
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11724
	else if (image->format == XYPixmap)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11725
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11726
	else if (image->format == ZPixmap)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11727
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11728
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11729
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11730
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11731
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11732
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11733
	XDestroyImage(image);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11734
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11735
    }
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11736
fail:
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11737
    if (image) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11738
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11739
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11740
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11741
    ^ false
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11742
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11743
    "Modified: / 11-04-2017 / 21:17:31 / cg"
8367
e0d6816f072b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8358
diff changeset
 11744
    "Modified: / 17-05-2018 / 16:45:14 / Stefan Vogel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11745
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11746
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11747
!XWorkstation methodsFor:'selection fetching'!
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 11748
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11749
getClipboardObjectFor:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11750
    "get the object selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11751
     Returns nil, if no selection is available.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11752
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11753
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11754
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11755
    |selectionOwnerWindowId selection|
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11756
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11757
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11758
    (selectionOwnerWindowId isNil   "no selection. There is the possibilty that one of our (modal) views has been closed.
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11759
				     Get the selection from our own buffer"
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11760
     or:[self viewIdKnown:selectionOwnerWindowId]) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11761
	"one of our own views still holds the selection, so return my locally buffered data"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11762
	^ copyBuffer
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11763
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11764
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11765
    drawableId isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11766
	"sorry, cannot fetch a selection, if there is no drawableId.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11767
	 Should I borrow a drawableId from another window?"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11768
	^ nil.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11769
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11770
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11771
    selection := SelectionFetcher
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11772
	requestSelection:clipboardAtom
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11773
	type:(self atomIDOf:#'ST_OBJECT')
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11774
	onDevice:self for:drawableId.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11775
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11776
    "/ should not happen
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11777
    "/ cg: disabled the code below: I don't want any string here (when asking for an object)
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11778
"/    selection isEmptyOrNil ifTrue:[
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11779
"/        selection := SelectionFetcher
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11780
"/            requestSelection:clipboardAtom
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11781
"/            type:(self atomIDOf:#'UTF8_STRING')
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11782
"/            onDevice:self for:drawableId.
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11783
"/
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11784
"/        selection isNil ifTrue:[
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11785
"/            selection := SelectionFetcher
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11786
"/                requestSelection:clipboardAtom
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11787
"/                type:(self atomIDOf:#STRING)
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11788
"/                onDevice:self for:drawableId.
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11789
"/        ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11790
"/    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11791
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
 11792
    selection isEmptyOrNil ifTrue:[ ^ copyBuffer ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11793
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11794
    ^ selection.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11795
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11796
    "
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11797
       Display getClipboardObjectFor:Transcript drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11798
    "
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11799
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11800
    "Modified (comment): / 27-04-2018 / 13:39:41 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11801
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11802
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11803
getClipboardText:selectionBufferSymbol for:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11804
    "get the text selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11805
     Returns nil, if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11806
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11807
    |selectionId selectionOwnerWindowId selection|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11808
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11809
    selectionBufferSymbol == #selection ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11810
	selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11811
    ] ifFalse:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11812
	selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11813
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11814
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11815
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11816
    (selectionOwnerWindowId isNil   "no selection. There is the possibilty that one of our (modal) views has been closed.
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11817
				     Get the selection from our own buffer"
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11818
     or:[self viewIdKnown:selectionOwnerWindowId]) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11819
	"One of our own views still holds the selection, so return my locally buffered data"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11820
	"JV@2012-04-02: Added support for PRIMARY/SELECTION buffers."
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11821
	^ selectionId == primaryAtom ifTrue:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11822
	    self primaryBufferAsString
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11823
	] ifFalse:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11824
	    self copyBufferAsString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11825
	]
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11826
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11827
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11828
    drawableId isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11829
	"sorry, cannot fetch a selection, if there is no drawableId.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11830
	 Should I borrow a drawableId from another window?"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11831
	 ^ nil.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11832
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11833
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11834
    selection := SelectionFetcher
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11835
	requestSelection:selectionId
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11836
	type:(self atomIDOf:#'UTF8_STRING')
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11837
	onDevice:self for:drawableId.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11838
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11839
    selection isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11840
	selection := SelectionFetcher
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11841
	    requestSelection:selectionId
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11842
	    type:(self atomIDOf:#STRING)
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11843
	    onDevice:self for:drawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11844
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11845
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11846
    ^ selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11847
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11848
     "
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11849
       Display getClipboardText:#clipboard for:Transcript drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11850
       Display getClipboardText:#selection for:Transcript drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11851
     "
5899
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11852
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11853
    "Modified: / 02-04-2012 / 10:34:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11854
    "Modified (comment): / 27-04-2018 / 13:40:07 / stefan"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11855
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11856
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11857
!XWorkstation methodsFor:'selection sending'!
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11858
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11859
selectionBuffer:bufferGetSelector as:aTargetAtomID
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11860
    "convert the current selection to the format defined by aTargetAtom.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11861
     Answer an association with the type of converted selection (an atomID)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11862
     and the converted selection"
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11863
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11864
    |buffer bufferAsString|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11865
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11866
    buffer := self perform:bufferGetSelector.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11867
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11868
    (aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11869
	"/ 'st-object' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11870
	"send the selection in binaryStore format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11871
	"require libboss to be loaded"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11872
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11873
	    Logger error:'cannot use binary store for copy buffer (libboss missing)'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11874
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11875
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11876
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11877
	[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11878
	    ^ aTargetAtomID -> (buffer binaryStoreBytes).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11879
	] on:Error do:[:ex|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11880
	    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
 11881
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11882
	].
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11883
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11884
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11885
    bufferAsString := self class bufferAsString:buffer.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11886
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11887
    (aTargetAtomID == (self atomIDOf:#STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11888
     or:[aTargetAtomID == (self atomIDOf:#'text/plain')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11889
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11890
	"/ 'string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11891
	"the other view wants the selection as string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11892
	^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11893
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11894
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11895
    (aTargetAtomID == (self atomIDOf:#UTF8_STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11896
     or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11897
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11898
	"/ 'utf string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11899
	"the other view wants the selection as utf8 string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11900
	^ aTargetAtomID -> (bufferAsString utf8Encoded).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11901
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11902
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11903
    aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11904
	"the other one wants to know the size of our selection.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11905
	 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
 11906
	 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
 11907
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11908
	^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11909
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11910
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11911
    "we do not support the requestet target type"
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11912
    ^ nil -> nil.
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11913
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11914
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11915
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11916
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11917
setClipboardObject:anObject owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11918
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11919
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11920
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11921
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11922
    clipboardSelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11923
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11924
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11925
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11926
setClipboardText:aString owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11927
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11928
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11929
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11930
     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
 11931
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11932
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11933
    clipboardSelectionTime := primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11934
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11935
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11936
    self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11937
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11938
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11939
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11940
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11941
setPrimaryText:aString owner:aWindowId
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11942
    "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
 11943
     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
 11944
     pasting. X Window specific."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11945
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11946
    primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11947
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11948
    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
 11949
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11950
    "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
 11951
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11952
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11953
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11954
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11955
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11956
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 11957
    "Note: some sender code assumes that ST_OBJECT is first"
8225
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11958
    ^ #(
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11959
	ST_OBJECT
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11960
	STRING
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11961
	UTF8_STRING
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11962
	TIMESTAMP
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11963
	TARGETS
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11964
	LENGTH
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11965
	#'text/plain'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11966
	#'text/plain;codeset=utf-8'
8225
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11967
    ) collect:[:eachTargetSymbol| self atomIDOf:eachTargetSymbol] as:IntegerArray.
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11968
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11969
    "Modified (format): / 24-11-2017 / 11:06:23 / cg"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11970
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11971
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11972
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11973
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11974
getSelectionOwnerOf:selectionAtomSymbolOrID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11975
    "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
 11976
     Answer nil, if there is no owner"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11977
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11978
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11979
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11980
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11981
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11982
    selectionAtomSymbolOrID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11983
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11984
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11985
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11986
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11987
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11988
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11989
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11990
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11991
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11992
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11993
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11994
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11995
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11996
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11997
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11998
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11999
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12000
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12001
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12002
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12003
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 12004
requestSelection:selectionID type:typeID for:aWindowId intoProperty:propertyID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12005
    "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
 12006
     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
 12007
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12008
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 12009
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 12010
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12011
    |anIntegerTimestamp|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12012
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12013
    anIntegerTimestamp := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12014
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12015
%{
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12016
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12017
    if (ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 12018
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 12019
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12020
     && __isAtomID(selectionID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12021
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12022
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12023
	Time time;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12024
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12025
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12026
	    w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12027
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12028
	    w = (Window)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12029
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12030
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12031
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12032
	if (anIntegerTimestamp == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12033
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12034
	     * 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
 12035
	     * the selection was requested and not to CurrentTime
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12036
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12037
	    time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12038
	} else if (__isInteger(anIntegerTimestamp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12039
	    time = __unsignedLongIntVal(anIntegerTimestamp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12040
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12041
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12042
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12043
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12044
	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12045
			       __AtomVal(propertyID), w, time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12046
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12047
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12048
	RETURN (true);
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12049
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12050
    }
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
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12053
    ^ false
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
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12056
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12057
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12058
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12059
	type:(Display atomIDOf:'STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12060
	for:Transcript id
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 12061
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 12062
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12063
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12064
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12065
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12066
	type:(Display atomIDOf:'C_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12067
	for:Transcript id
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12068
    "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12069
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12070
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 12071
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
 12072
    "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
 12073
     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
 12074
     could not be converted.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 12075
     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
 12076
     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
 12077
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12078
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12079
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12080
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12081
	&& (__isAtomID(propertyID) || propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12082
	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12083
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12084
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12085
	Window requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12086
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12087
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12088
	if (__isExternalAddress(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12089
	    requestor = __WindowVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12090
	} else if (__isSmallInteger(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12091
	    requestor = (Window)__smallIntegerVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12092
	} else if (requestorID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12093
	    requestor = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12094
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12095
	    requestor = (Window)__unsignedLongIntVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12096
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12097
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12098
	ev.xselection.type = SelectionNotify;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12099
	ev.xselection.display = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12100
	ev.xselection.selection = __AtomVal(selectionID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12101
	ev.xselection.target = __AtomVal(targetID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12102
	ev.xselection.requestor = requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12103
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12104
	if (__isExternalAddress(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12105
	    ev.xselection.time = (INT)(__externalAddressVal(aTime));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12106
	} else if (__isSmallInteger(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12107
	    ev.xselection.time = __smallIntegerVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12108
	} else if (aTime == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12109
	    ev.xselection.time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12110
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12111
	    ev.xselection.time = (INT)__unsignedLongIntVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12112
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 12113
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12114
	console_printf("ev.xselection.selection: %x\n", ev.xselection.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12115
	console_printf("ev.xselection.target: %x\n", ev.xselection.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12116
	console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12117
	console_printf("ev.xselection.time: %x\n", ev.xselection.time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12118
	console_printf("requestor: %x\n", requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12119
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12120
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12121
	/* send nil property if selection cannot be converted */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12122
	if (propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12123
	    ev.xselection.property = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12124
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12125
	    ev.xselection.property = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12126
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12127
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12128
	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
 12129
		(INT)ev.xselection.selection,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12130
		(INT)ev.xselection.property,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12131
		(INT)ev.xselection.target,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12132
		(INT)ev.xselection.requestor,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12133
		(INT)requestor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12134
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12135
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12136
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12137
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12138
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12139
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12140
	    DPRINTF(("bad status\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12141
	    RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12142
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12143
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12144
	XFlush(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12145
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12146
	RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12147
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12148
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12149
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 12150
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 12151
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 12152
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12153
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12154
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12155
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID time:anIntegerTimestamp
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12156
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12157
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12158
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12159
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12160
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12161
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12162
    selectionAtomSymbolOrID isString ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12163
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12164
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12165
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12166
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12167
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12168
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12169
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12170
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12171
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 12172
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12173
     && ISCONNECTED) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12174
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12175
	Time time;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12176
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12177
	win = __WindowVal(aWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12178
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12179
	if (anIntegerTimestamp == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12180
	    /*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12181
	     * the ICCCM convention says: you should set the time to the time when
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12182
	     * the selection was acquired and not to CurrentTime
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12183
	     */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12184
	    time = CurrentTime;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12185
	} else if (__isInteger(anIntegerTimestamp)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12186
	    time = __unsignedLongIntVal(anIntegerTimestamp);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12187
	} else
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12188
	    goto err;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12189
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12190
	DPRINTF(("setOwner prop=%"_lx_" win=%"_lx_"\n", (INT)__AtomVal(selectionAtomID), (INT)win));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12191
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12192
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12193
	RETURN (self);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12194
	LEAVE_XLIB();
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12195
    }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 12196
err:;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 12197
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12198
    self primitiveFailedOrClosedConnection.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 12199
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 12200
    "Modified: / 27-04-2018 / 11:56:21 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12201
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12202
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12203
!XWorkstation methodsFor:'window queries'!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12204
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12205
allChildIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12206
    "return all children-ids of the given window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12207
     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
 12208
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12209
    |childIDs allChildIDs|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12210
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12211
    allChildIDs := OrderedCollection new.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12212
    childIDs := self childIdsOf:aWindowId.
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
 12213
    childIDs notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12214
	allChildIDs addAll:childIDs.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12215
	childIDs do:[:eachChildId |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12216
	    allChildIDs addAll:(self allChildIdsOf:eachChildId).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12217
	].
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12218
    ].
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12219
    ^ allChildIDs
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12220
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12221
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12222
     Display allChildIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12223
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12224
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12225
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12226
     |deviceIDAtom uuidAtom|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12227
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12228
     deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12229
     uuidAtom     := (Display atomIDOf:#'UUID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12230
     (Display allChildIdsOf:(Display rootWindowId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12231
	select:[:id |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12232
	    |uuid|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12233
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12234
	    Display
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12235
		getProperty:deviceIDAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12236
		from:id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12237
		delete:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12238
		into:[:type :value |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12239
		    type == uuidAtom ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12240
			uuid := UUID fromBytes:value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12241
		    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12242
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12243
	    uuid notNil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12244
	]
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12245
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12246
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12247
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12248
childIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12249
    "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
 12250
     enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12251
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12252
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12253
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12254
    |childIdArray|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12255
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12256
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12257
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12258
    if (ISCONNECTED
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12259
     && __isExternalAddress(aWindowId)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12260
	Display *dpy = myDpy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12261
	Window win = __WindowVal(aWindowId);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12262
	Window rootReturn, parentReturn;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12263
	Window* children = (Window *)0;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12264
	unsigned int numChildren;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12265
	int i;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12266
	int rslt;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12267
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12268
	ENTER_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12269
	rslt = XQueryTree(dpy, win,
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12270
		       &rootReturn, &parentReturn,
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12271
		       &children, &numChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12272
	LEAVE_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12273
	if (rslt) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12274
	    childIdArray = __ARRAY_NEW_INT(numChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12275
	    if (childIdArray != nil) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12276
		for (i=0; i < numChildren; i++) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12277
		    if (children[i]) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12278
			OBJ childId;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12279
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12280
			childId = __MKEXTERNALADDRESS(children[i]);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12281
			__ArrayInstPtr(childIdArray)->a_element[i] = childId;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12282
			__STORE(childIdArray, childId);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12283
		    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12284
		}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12285
		if (children) XFree(children);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12286
	    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12287
	    RETURN (childIdArray);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12288
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12289
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12290
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12291
    ^ nil.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12292
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12293
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12294
      Display childIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12295
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12296
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12297
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12298
realRootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12299
    "return the id of the real root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12300
     This may not be the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12301
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12302
     of it. Except for very special cases, use #rootWindowId, which takes
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12303
     care of any virtual root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12304
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12305
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12306
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12307
    Window root;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12308
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12309
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12310
    if (__INST(rootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12311
	RETURN (__INST(rootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12312
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12313
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12314
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12315
	root = RootWindow(myDpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12316
	if (! root) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12317
	    id = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12318
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12319
	    id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12320
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12321
	RETURN (id);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12322
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12323
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12324
    self primitiveFailedOrClosedConnection.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12325
    ^ nil
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12326
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12327
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12328
      Display rootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12329
      Display realRootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12330
    "
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12331
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12332
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12333
rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12334
    "return the id of the root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12335
     This is the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12336
     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
 12337
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12338
     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
 12339
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12340
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12341
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12342
    Window rootWin, vRootWin = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12343
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12344
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12345
    if (__INST(virtualRootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12346
	RETURN (__INST(virtualRootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12347
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12348
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12349
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12350
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12351
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12352
	rootWin = RootWindow(dpy, screen);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12353
#ifndef IRIS
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12354
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12355
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12356
	 * on IRIS, this creates a badwindow error - why ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12357
	 * children contains a funny window (000034)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12358
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12359
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12360
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12361
	 * care for virtual root windows (tvtwm & friends)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12362
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12363
	{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12364
	    Atom vRootAtom, kwinAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12365
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12366
	    Window rootReturn, parentReturn;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12367
	    Window* children = (Window *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12368
	    unsigned int numChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12369
	    int ignoreVRoot = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12370
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12371
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12372
	     * Take care of KDE 2.1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12373
	     * they define _SWM_ROOT but this is not the parent of
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12374
	     * the application windows.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12375
	     * Instead it is used for background painting
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12376
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12377
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12378
	    kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12379
	    if (kwinAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12380
		Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12381
		int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12382
		unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12383
		unsigned char *retVal = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12384
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12385
		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12386
				       0L, 1L, False, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12387
				       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12388
				       &nitems, &bytesafter, &retVal) == Success
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12389
			      && actual_type != 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12390
		if (retVal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12391
		    XFree(retVal);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12392
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12393
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12394
	    if (!ignoreVRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12395
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12396
		if (vRootAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12397
		    if (XQueryTree(dpy, rootWin,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12398
				       &rootReturn, &parentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12399
				       &children, &numChildren)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12400
			for (i=0; i < numChildren; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12401
			    Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12402
			    int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12403
			    unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12404
			    Window* newRoot = (Window*) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12405
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12406
			    if (children[i]) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12407
				if (XGetWindowProperty(dpy, children[i], vRootAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12408
						       0L, 1L, False, XA_WINDOW,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12409
						       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12410
						       &nitems, &bytesafter,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12411
						       (unsigned char**) &newRoot
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12412
						      ) == Success && newRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12413
				    vRootWin = *newRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12414
				    XFree(newRoot); /* XXX */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12415
				    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12416
				}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12417
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12418
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12419
			if (children) XFree(children);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12420
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12421
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12422
	     }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12423
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12424
#endif
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12425
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12426
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12427
    if (! vRootWin) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12428
	vRootWin = rootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12429
	if (! vRootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12430
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12431
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12432
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12433
    id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12434
    id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12435
    RETURN ( id );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12436
%}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12437
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12438
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12439
      Display rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12440
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12441
! !
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12442
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12443
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12444
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12445
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12446
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12447
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12448
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12449
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12450
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12451
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12452
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12453
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12454
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12455
	 && __bothSmallInteger(x, y)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12456
	 && __bothSmallInteger(width, height)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12457
	    w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12458
	    h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12459
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12460
	     * 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
 12461
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12462
	    if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12463
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12464
		XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12465
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12466
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12467
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12468
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12469
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12470
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12471
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12472
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12473
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12474
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12475
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12476
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12477
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12478
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12479
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12480
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12481
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12482
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12483
	    XClearWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12484
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12485
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12486
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12487
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12488
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12489
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12490
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12491
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12492
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12493
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12494
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12495
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12496
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12497
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12498
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12499
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12500
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12501
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12502
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12503
	 && __isExternalAddress(siblingId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12504
	    if (modeSymbol == @symbol(above)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12505
		chg.stack_mode = Above;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12506
	    } else if (modeSymbol == @symbol(below)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12507
		chg.stack_mode = Below;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12508
	    } else if (modeSymbol == @symbol(topIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12509
		chg.stack_mode = TopIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12510
	    } else if (modeSymbol == @symbol(bottomIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12511
		chg.stack_mode = BottomIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12512
	    } else if (modeSymbol == @symbol(opposite)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12513
		chg.stack_mode = Opposite;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12514
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12515
		mask = CWSibling;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12516
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12518
	    chg.sibling = __WindowVal(siblingId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12519
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12520
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12521
				    mask, &chg);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12522
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12523
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12524
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12525
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12526
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12527
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12528
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12529
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12530
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12531
getGeometryOf:aWindowId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12532
    "get a windows geometry.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12533
     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
 12534
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12535
     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
 12536
     relative to such a wrapper.
8386
184439a867ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8368
diff changeset
 12537
     In contrast, the values found in the view's instance variables are virtual dimensions
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12538
     (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
 12539
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12540
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12541
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12542
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12543
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12544
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12545
    int x_ret, y_ret;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12546
    unsigned int width_ret, height_ret,
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12547
		 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12548
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12549
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12550
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12551
     && __isExternalAddress(aWindowId)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12552
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12553
	XGetGeometry(myDpy, __WindowVal(aWindowId),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12554
		     &root_ret,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12555
		     &x_ret, &y_ret,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12556
		     &width_ret, &height_ret, &border_width_ret,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12557
		     &depth_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12558
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12559
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12560
	x = __MKSMALLINT(x_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12561
	y = __MKSMALLINT(y_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12562
	width = __MKSMALLINT(width_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12563
	height = __MKSMALLINT(height_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12564
	depth = __MKSMALLINT(depth_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12565
	borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12566
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12567
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12568
    borderWidth isNil ifTrue:[
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12569
	self primitiveFailedOrClosedConnection.
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12570
	^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12571
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12572
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12573
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12574
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12575
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12576
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12577
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12578
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12579
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12580
     Transcript topView device
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12581
	getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12582
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12583
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12584
     Transcript topView device
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12585
	getGeometryOf:(Transcript topView id)
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12586
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12587
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12588
     Display
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12589
	getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12590
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12591
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12592
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12593
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12594
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12595
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12596
    "
8386
184439a867ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8368
diff changeset
 12597
184439a867ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8368
diff changeset
 12598
    "Modified: / 14-06-2018 / 10:20:52 / Claus Gittinger"
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12599
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12600
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12601
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12602
    "return true, if the given window ID is (still) valid.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12603
     Especially useful, if the passed windowID is
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12604
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12605
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12606
"/ Enable when enabling ENTER_XLIB() below
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12607
"/    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12608
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12609
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12610
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12611
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12612
%{
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12613
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12614
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12615
     && __isExternalAddress(aWindowId)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12616
	char *name = NULL;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12617
	Status ok;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12618
	Window root, parent, *children = NULL;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12619
	unsigned int nChildren;
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12620
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12621
/*        ENTER_XLIB(); */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12622
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12623
			&root, &parent, &children, &nChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12624
	if (children) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12625
	    XFree(children);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12626
	}
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12627
/*        LEAVE_XLIB();   */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12628
	if (ok) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12629
	    RETURN (true);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12630
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12631
	RETURN (false);
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12632
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12633
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12634
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12635
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12636
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12637
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12638
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12639
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12640
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12641
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12642
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12643
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12644
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12645
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12646
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12647
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12648
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12649
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12650
    "
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12651
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12652
    "Modified: / 03-05-2018 / 16:28:44 / stefan"
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12653
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12654
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12655
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12656
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12657
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12658
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12659
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12660
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12661
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12662
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12663
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12664
	XLowerWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12665
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12666
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12667
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12668
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12669
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12670
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12671
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12672
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12673
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12674
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12675
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12676
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12677
    "make a window visible - either as icon or as a real view
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12678
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12679
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12680
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12681
4480
3e1449309dfa Set icon mask in #mapWindow:....
Stefan Vogel <sv@exept.de>
parents: 4478
diff changeset
 12682
    |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12683
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12684
    aBoolean ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12685
	wicon := aView icon.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12686
	wicon notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12687
	    wiconId := wicon drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12688
	    wicon mask notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12689
		iconMaskId := wicon mask drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12690
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12691
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12692
	wiconView := aView iconView.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12693
	wiconView notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12694
	    wiconViewId := wiconView drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12695
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12696
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12697
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12698
    minExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12699
	minW := minExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12700
	minH := minExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12701
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12702
    maxExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12703
	maxW := maxExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12704
	maxH := maxExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12705
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12706
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12707
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12708
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12709
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12710
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12711
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12712
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12713
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12714
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12715
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12716
	win = __WindowVal(aWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12717
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12718
	szhints.flags = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12719
	if (__bothSmallInteger(xPos, yPos)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12720
	    szhints.x = __intVal(xPos);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12721
	    szhints.y = __intVal(yPos);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12722
	    szhints.flags |= USPosition;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12723
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12724
	if (__bothSmallInteger(w, h)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12725
	    szhints.width = __intVal(w);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12726
	    szhints.height = __intVal(h);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12727
	    szhints.flags |= USSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12728
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12729
	if (__bothSmallInteger(minW, minH)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12730
	    szhints.flags |= PMinSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12731
	    szhints.min_width = __intVal(minW);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12732
	    szhints.min_height = __intVal(minH);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12733
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12734
	if (__bothSmallInteger(maxW, maxH)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12735
	    szhints.flags |= PMaxSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12736
	    szhints.max_width = __intVal(maxW);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12737
	    szhints.max_height = __intVal(maxH);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12738
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12739
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12740
	if (aBoolean == true) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12741
	    char *windowName = "";
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12742
	    Pixmap iconBitmap = (Pixmap)0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12743
	    Pixmap iconMask = (Pixmap)0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12744
	    Window iconWindow = (Window)0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12745
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12746
	    if (__isExternalAddress(wiconId))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12747
		iconBitmap = __PixmapVal(wiconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12748
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12749
	    if (__isExternalAddress(iconMaskId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12750
		iconMask = __PixmapVal(iconMaskId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12751
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12752
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12753
	    if (__isExternalAddress(wiconViewId))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12754
		iconWindow = __WindowVal(wiconViewId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12755
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12756
	    if (__isStringLike(wlabel))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12757
		windowName = (char *) __stringVal(wlabel);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12758
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12759
	    if (iconBitmap || windowName) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12760
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12761
		XSetStandardProperties(dpy, win,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12762
					windowName, windowName,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12763
					iconBitmap,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12764
					0, 0, &szhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12765
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12766
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12767
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12768
	    wmhints.flags = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12769
	    if (iconBitmap) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12770
		wmhints.flags |= IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12771
		wmhints.icon_pixmap = iconBitmap;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12772
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12773
	    if (iconMask) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12774
		wmhints.flags |= IconMaskHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12775
		wmhints.icon_mask = iconMask;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12776
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12777
	    if (iconWindow) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12778
		wmhints.flags |= IconWindowHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12779
		wmhints.icon_window = iconWindow;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12780
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12781
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12782
	    wmhints.initial_state = IconicState;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12783
	    wmhints.flags |= StateHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12784
	    ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12785
	    XSetWMHints(dpy, win, &wmhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12786
	    LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12787
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12788
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12789
	if (szhints.flags) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12790
	    ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12791
	    XSetNormalHints(dpy, win, &szhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12792
	    LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12793
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12794
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12795
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12796
	XMapWindow(dpy, win);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12797
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12798
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12799
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12800
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12801
    self primitiveFailedOrClosedConnection
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 12802
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 12803
    "Modified: / 26-04-2018 / 11:01:29 / stefan"
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12806
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12807
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12808
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12809
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12810
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12811
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12812
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12813
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12814
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12815
	XMapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12816
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12817
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12818
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12819
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12820
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12821
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12822
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12823
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12824
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12825
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12826
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12827
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12828
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12829
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12830
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12831
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12832
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12833
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12834
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12835
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12836
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12837
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12838
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12839
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12840
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12841
			      __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12842
			      newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12843
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12844
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12845
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12846
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12847
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12848
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12849
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12850
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12851
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12852
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12853
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12854
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12855
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12856
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12857
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12858
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12859
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12860
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12861
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12862
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12863
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12864
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12865
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12866
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12867
newGraphicsContextFor:aGraphicsMedium
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12868
    "Redefined to use my own device specific graphics context"
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12869
7486
c3a1433996ec #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7478
diff changeset
 12870
    ^ X11GraphicsContext onDevice:self.
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12871
!
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12872
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12873
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12874
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12875
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12876
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12877
"/ Enable when enabling ENTER_XLIB() below
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12878
"/    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12879
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12880
%{
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12881
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12882
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12883
     && __isExternalAddress(aWindowId)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12884
	Status ok;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12885
	Window root, parent, *children = NULL;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12886
	unsigned int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12887
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12888
/*        ENTER_XLIB(); */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12889
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12890
			&root, &parent, &children, &nChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12891
	if (children) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12892
	    XFree(children);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12893
	}
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12894
/*        LEAVE_XLIB();   */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12895
	if (! ok) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12896
	    RETURN ( nil );
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12897
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12898
	RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12899
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12900
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12901
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12902
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12903
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12904
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12905
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12906
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12907
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12908
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12909
    "
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12910
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12911
    "Modified: / 03-05-2018 / 16:29:19 / stefan"
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12912
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12913
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12914
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12915
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12916
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12917
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12918
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12919
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12920
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12921
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12922
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12923
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12924
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12925
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12926
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12927
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12928
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12929
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12930
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12931
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12932
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12933
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12934
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12935
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12936
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12937
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12938
     && __isExternalAddress(newParentWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12939
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12940
	Window _child, _newParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12941
	int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12942
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12943
	_child = __WindowVal(windowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12944
	_newParent = __WindowVal(newParentWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12945
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12946
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12947
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12948
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12949
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12950
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12951
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12952
	 * Code 'stolen' from xswallow source ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12953
	 * ... mhmh - what is this loop for ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12954
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12955
	for (i=0; i<5; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12956
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12957
	    XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12958
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12959
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12960
	XMapWindow (dpy, _child);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12961
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12962
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12963
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12964
	RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12965
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12966
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12967
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12968
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12969
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12970
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12971
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12972
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12973
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12974
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12975
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12976
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12977
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12978
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12979
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12980
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12981
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12982
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12983
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12984
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12985
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12986
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12987
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12988
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12989
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12990
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12991
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12992
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12993
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12994
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12995
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12996
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12997
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12998
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12999
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13000
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13001
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13002
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13003
	if (__INST(ignoreBackingStore) != true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13004
	    if (how == @symbol(always)) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13005
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13006
	    else if (how == true) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13007
	    else wa.backing_store = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13008
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13009
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13010
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13011
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13012
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13013
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13014
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13015
    }
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
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13018
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13019
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13020
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13021
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13022
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13023
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13024
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13025
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13026
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13027
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13028
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13029
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13030
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13031
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13032
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13033
	    wa.bit_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13034
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13035
	    wa.bit_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13036
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13037
	    wa.bit_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13038
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13039
	    wa.bit_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13040
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13041
	    wa.bit_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13042
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13043
	    wa.bit_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13044
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13045
	    wa.bit_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13046
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13047
	    wa.bit_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13048
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13049
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13050
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13051
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13054
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13055
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13056
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13057
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13058
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13059
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13060
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13061
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13062
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13063
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13064
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13065
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13066
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13067
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13068
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13069
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13070
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13071
     && __isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13072
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13073
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13074
	Cursor c = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13075
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13076
	if (w && c) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13077
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13078
	    XDefineCursor(dpy, w, c);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13079
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13080
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13081
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13082
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13083
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13084
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13085
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13086
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13087
setForegroundWindow:aWindowId
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13088
    "bring a window to front.
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13089
     Send a specific message to the WindowManager"
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13090
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13091
    |activeWindowAtom|
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13092
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13093
"/    self raiseWindow:aWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13094
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13095
    activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13096
    activeWindowAtom notNil ifTrue:[
8681
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13097
        self
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13098
            sendClientEvent:activeWindowAtom
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13099
            format:32
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13100
            to:(self rootWindowId)
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13101
            propagate:false
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13102
            eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13103
            window:aWindowId
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13104
            data1:2                 "activate request from pager. This is a trick: kwm ignores requests from applications (1)"
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13105
            data2:nil
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13106
            data3:nil
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13107
            data4:nil
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13108
            data5:nil.
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13109
    ] ifFalse:[
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13110
        "/ fallback    
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13111
        self raiseWindowToTop:aWindowId.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13112
    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13113
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13114
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13115
      Transcript topView setForegroundWindow
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13116
    "
8681
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13117
66d2c2026494 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8670
diff changeset
 13118
    "Modified (format): / 24-05-2019 / 12:39:58 / Stefan Vogel"
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13119
!
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 13120
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13121
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13122
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13123
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13124
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13125
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13126
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13127
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13128
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13129
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13130
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 13131
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13132
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13133
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 13134
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13135
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13136
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13137
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13138
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13139
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13140
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13141
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13142
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13143
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13144
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13145
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13146
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13147
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13148
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13149
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13150
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13151
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13152
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13153
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13154
	XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13155
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13156
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13157
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13158
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13159
    self primitiveFailedOrClosedConnection
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 13160
!
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 13161
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13162
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13163
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13164
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13165
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13166
%{
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
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13169
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13170
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13171
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13172
	if (__INST(hasSaveUnder) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13173
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13174
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13175
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13176
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13177
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13178
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13179
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13180
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13181
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13182
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13183
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13184
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13185
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13186
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13187
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13188
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13189
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13190
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13191
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13192
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13193
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13194
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13195
	    w = (Window) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13196
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13197
	    if (__isExternalAddress(aMainWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13198
		w = __WindowVal(aMainWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13199
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13200
		goto getOutOfHere;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13201
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13202
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13203
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13204
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13205
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13206
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13207
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 13208
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13209
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13210
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13211
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13212
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13213
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13214
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13215
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13216
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13217
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13218
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13219
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13220
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13221
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13222
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13223
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13224
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13225
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13226
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13227
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13228
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13229
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13230
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13231
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13232
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13233
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13234
    "set the windows background pattern to be a form.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13235
     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
 13236
     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
 13237
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13238
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13239
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
 13240
%{  /* STACK: 64000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13241
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13242
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13243
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13244
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13245
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13246
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13247
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13248
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13249
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13250
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13251
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13252
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13253
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13254
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13255
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13256
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13257
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13258
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13259
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13260
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13261
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13262
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13263
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13264
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13265
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13266
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13267
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13268
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13269
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13270
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13271
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13272
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13273
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13274
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13275
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13276
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13277
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13278
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13279
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13280
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13281
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13282
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13283
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13284
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13285
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 13286
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13287
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13288
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13289
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13290
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13291
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13292
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13293
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13294
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13295
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13296
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13297
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13298
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13299
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13300
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13301
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13302
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13303
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13304
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13305
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13306
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13307
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13308
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13309
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13310
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13311
			  0, 0, shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13312
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13313
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13314
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13315
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13316
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13317
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13318
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13319
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13320
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13321
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13322
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13323
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13324
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13325
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13326
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13327
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13328
     && __isSmallInteger(aNumber)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13329
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13330
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13331
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13332
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13333
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13334
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13335
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13336
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13337
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13338
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
 13339
    "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
 13340
     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
 13341
     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
 13342
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13343
    <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
 13344
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13345
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13346
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13347
	XClassHint classhint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13348
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13349
	classhint.res_class = classhint.res_name = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13350
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13351
	if (__isStringLike(wClass)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13352
	    classhint.res_class = (char *) __stringVal(wClass);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13353
	} else if (wClass != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13354
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13355
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13356
	if (__isStringLike(wName)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13357
	    classhint.res_name = (char *) __stringVal(wName);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13358
	} else if (wName != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13359
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13360
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13361
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13362
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13363
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13364
	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
 13365
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 13366
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 13367
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13368
    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
 13369
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 13370
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13371
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13372
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13373
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13374
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13375
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13376
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13377
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13378
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13379
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13380
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13381
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13382
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13383
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13384
	    wa.win_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13385
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13386
	    wa.win_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13387
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13388
	    wa.win_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13389
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13390
	    wa.win_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13391
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13392
	    wa.win_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13393
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13394
	    wa.win_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13395
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13396
	    wa.win_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13397
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13398
	    wa.win_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13399
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13400
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13401
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13402
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13403
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13404
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13405
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13406
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13407
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13408
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13409
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13410
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13411
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13412
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13413
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13414
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13415
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13416
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13417
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13418
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13419
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13420
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13421
    aForm notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13422
	iconId := aForm drawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13423
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13424
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13425
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13426
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13427
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13428
	XWMHints hints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13429
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13430
	hints.icon_pixmap = __PixmapVal(iconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13431
	hints.flags = IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13432
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13433
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13434
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13435
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13436
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13437
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13438
    self primitiveFailedOrClosedConnection
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13439
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13440
    "Modified: / 26-04-2018 / 11:00:51 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13441
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13442
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13443
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13444
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13445
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13446
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13447
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13448
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13449
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13450
    aForm notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13451
	iconId := aForm drawableId.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13452
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13453
    aMaskForm notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13454
	maskId := aMaskForm drawableId.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13455
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13456
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13457
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13458
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13459
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13460
	XWMHints hints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13461
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13462
	hints.icon_pixmap = __PixmapVal(iconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13463
	hints.flags = IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13464
	if ((maskId != nil)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13465
	 && __isExternalAddress(maskId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13466
	    hints.icon_mask = __PixmapVal(maskId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13467
	    hints.flags |= IconMaskHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13468
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13469
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13470
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13471
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13472
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13473
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13474
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13475
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13476
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13477
    "Modified: / 26-04-2018 / 11:01:04 / stefan"
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13478
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13479
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13480
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13481
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13482
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13483
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13484
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13485
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13486
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13487
    aView notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13488
	iconWindowId := aView drawableId.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13489
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13490
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13491
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13492
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13493
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13494
	XWMHints wmhints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13495
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13496
	wmhints.icon_window = __WindowVal(iconWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13497
	wmhints.flags = IconWindowHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13498
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13499
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13500
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13501
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13502
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13503
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13504
    self primitiveFailedOrClosedConnection
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13505
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13506
    "Modified: / 26-04-2018 / 11:01:12 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13507
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13508
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 13509
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
 13510
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13511
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13512
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13513
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13514
%{
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13515
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13516
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13517
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13518
	XSizeHints szhints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13519
	Window win;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13520
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13521
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13522
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13523
	szhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13524
	if (__bothSmallInteger(minW, minH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13525
	    szhints.flags |= PMinSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13526
	    szhints.min_width = __intVal(minW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13527
	    szhints.min_height = __intVal(minH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13528
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13529
	if (__bothSmallInteger(maxW, maxH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13530
	    szhints.flags |= PMaxSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13531
	    szhints.max_width = __intVal(maxW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13532
	    szhints.max_height = __intVal(maxH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13533
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13534
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13535
	if (szhints.flags) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13536
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13537
	    XSetNormalHints(dpy, win, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13538
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13539
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13540
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13541
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13542
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13543
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13544
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13545
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13546
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13547
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13548
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13549
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13550
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13551
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13552
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13553
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 13554
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13555
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13556
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 13557
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13558
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13559
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13560
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13561
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13562
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13563
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13564
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13565
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13566
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13567
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13568
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13569
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13570
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13571
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13572
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13573
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13574
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13575
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13576
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13577
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13578
	XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13579
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13580
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13581
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13582
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13583
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13584
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13585
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
 13586
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
 13587
    "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
 13588
     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
 13589
     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
 13590
     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
 13591
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13592
    | pid |
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13593
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13594
    pid := anIntegerOrNil isNil
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13595
		ifTrue:[OperatingSystem getProcessId]
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13596
		ifFalse:[anIntegerOrNil].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13597
    self
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13598
	setProperty:#'_NET_WM_PID'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13599
	type:#CARDINAL
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13600
	value:pid
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13601
	for:aWindowId
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
 13602
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
 13603
    "Created: / 04-01-2013 / 16:03:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13604
    "Modified: / 26-04-2018 / 10:46:24 / stefan"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 13605
    "Modified (format): / 30-10-2018 / 12:58:24 / Claus Gittinger"
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
 13606
!
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
 13607
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13608
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13609
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13610
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13611
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13612
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13613
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13614
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13615
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13616
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13617
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13618
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13619
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13620
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13621
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13622
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13623
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13624
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13625
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13626
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13627
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13628
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13629
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13630
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13631
			  0, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13632
			  shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13633
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13634
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13635
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13636
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13637
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13638
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13639
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13640
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13641
setWindowState:aSymbol in:aWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13642
    "tell the window type to the window manager.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13643
     Send a specific message to the WindowManager"
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13644
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13645
    |netWmWindowStateAtom stateAtom|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13646
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13647
    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
 13648
    stateAtom := self atomIDOf:aSymbol create:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13649
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13650
    (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13651
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13652
	    sendClientEvent:netWmWindowStateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13653
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13654
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13655
	    propagate:true
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13656
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13657
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13658
	    data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13659
	    data2:stateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13660
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13661
	    data4:1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13662
	    data5:nil.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13663
    ] ifFalse:[self halt.].
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13664
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13665
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13666
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13667
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13668
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13669
      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
 13670
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13671
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13672
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13673
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13674
setWindowType:aSymbol in:aWindowOrWindowId
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13675
    "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
 13676
     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
 13677
     chapter 'Application Window Properties'
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13678
     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
 13679
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13680
     It also helps to fix super-annoying problem with window autoraiser
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13681
     on X11 in a proper way - window manager should manage top-level
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13682
     window stacking, that's why it is called a 'window manager' :-)"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13683
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13684
    | valueAtom |
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13685
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13686
    self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13687
		  _NET_WM_WINDOW_TYPE_DOCK
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13688
		  _NET_WM_WINDOW_TYPE_TOOLBAR
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13689
		  _NET_WM_WINDOW_TYPE_MENU
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13690
		  _NET_WM_WINDOW_TYPE_UTILITY
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13691
		  _NET_WM_WINDOW_TYPE_SPLASH
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13692
		  _NET_WM_WINDOW_TYPE_DIALOG
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13693
		  _NET_WM_WINDOW_TYPE_NORMAL) includes: aSymbol).
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13694
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13695
    valueAtom := self atomIDOf:aSymbol create:false.
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13696
    valueAtom isNil ifTrue:[
8613
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13697
	"/ Hmm, no such property, not running under EWMH compliant WM?
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13698
	self breakPoint: #jv.
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13699
	^ self
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13700
    ].
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13701
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13702
    self
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13703
	setProperty:#'_NET_WM_WINDOW_TYPE'
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13704
	type:#ATOM
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13705
	value:valueAtom
e075e50db4ac + displayPoints
Claus Gittinger <cg@exept.de>
parents: 8564
diff changeset
 13706
	for:aWindowOrWindowId.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13707
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13708
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13709
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13710
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13711
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13712
      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
 13713
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13714
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13715
      |v|
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13716
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13717
      v := TopView new create.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13718
      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
 13719
      v open.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13720
    "
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13721
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13722
    "Modified (comment): / 15-05-2012 / 10:49:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13723
    "Modified (format): / 26-04-2018 / 10:48:59 / stefan"
8564
8f02ab430d57 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8562
diff changeset
 13724
    "Modified (format): / 30-10-2018 / 20:57:47 / Claus Gittinger"
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13725
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13726
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13727
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13728
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13729
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13730
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13731
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13732
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13733
     * 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
 13734
     */
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13735
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13736
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13737
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13738
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13739
    if (__isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13740
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13741
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13742
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13743
	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
 13744
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13745
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13746
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13747
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13748
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13749
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13750
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13751
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13752
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13753
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13754
%{
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13755
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13756
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13757
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13758
	Atom JunkAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13759
	int JunkInt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13760
	unsigned long WinState,JunkLong;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13761
	unsigned char *Property;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13762
	Atom WM_STATE_Atom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13763
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13764
	if (__INST(wmStateAtom) != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13765
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13766
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13767
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13768
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13769
			       WM_STATE_Atom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13770
			       0L, 2L, False, AnyPropertyType,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13771
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13772
			       &Property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13773
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13774
	    WinState=(unsigned long)(*((long*)Property));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13775
	    if (WinState==3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13776
		RETURN (true);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13777
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13778
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13779
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13780
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13781
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13782
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13783
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13784
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13785
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13786
!XWorkstation::PseudoDeviceWithoutXFTSupport class methodsFor:'documentation'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13787
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13788
documentation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13789
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13790
    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
 13791
    possibly overriding some messages.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13792
    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
 13793
    interface, which cannot draw strings into pixmaps using XFT fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13794
    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
 13795
    so it will draw using non-xft fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13796
    This should vanish, once the xft drawing works.
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13797
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13798
    [author:]
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13799
	cg
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13800
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13801
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13802
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13803
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'accessing'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13804
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13805
realDevice:aDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13806
    realDevice := aDevice.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13807
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13808
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13809
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'message forwarding'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13810
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13811
doesNotUnderstand:aMessage
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13812
    ^ aMessage sendTo:realDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13813
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13814
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13815
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'queries'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13816
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13817
deviceFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13818
    ^ realDevice deviceFonts keys reject:[:f | f isXftFont ]
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13819
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13820
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13821
supportsXftFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13822
    ^ false.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13823
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13824
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13825
!XWorkstation::SelectionFetcher class methodsFor:'documentation'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13826
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13827
documentation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13828
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13829
    This class is responsible for fetching the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13830
    The X11 clipboard is implemented via asynchonous messages.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13831
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13832
    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
 13833
    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
 13834
    process that requests the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13835
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13836
    [author:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13837
	Stefan Vogel (stefan@zwerg)
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13838
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13839
    [instance variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13840
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13841
    [class variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13842
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13843
    [see also:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13844
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13845
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13846
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13847
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13848
!XWorkstation::SelectionFetcher class methodsFor:'selections'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13849
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13850
requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13851
    ^ 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
 13852
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13853
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13854
!XWorkstation::SelectionFetcher methodsFor:'accessing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13855
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13856
drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13857
    ^ drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13858
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13859
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13860
getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13861
    "convert the data in buffer to a selection"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13862
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13863
    |selection|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13864
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13865
    buffer isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13866
	^ nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13867
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13868
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13869
    targetID == (display atomIDOf:#STRING) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13870
	display clipboardEncoding notNil ifTrue:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13871
	    selection := buffer decodeFrom:display clipboardEncoding
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13872
	].
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13873
	selection := buffer.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13874
    ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13875
	"/ Transcript show:'UTF8: '; showCR:buffer storeString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13876
	[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13877
	    selection := buffer utf8Decoded.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13878
	] on:Error do:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13879
	    selection := buffer asString
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13880
	]
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13881
    ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13882
	"/ Transcript show:'TEXT: '; showCR:buffer storeString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13883
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13884
    ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13885
	"/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13886
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13887
    ]]]].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13888
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13889
    selection notNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13890
	(selection endsWith:Character cr) ifTrue:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13891
	    selection := selection asStringCollection copyWith:''
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13892
	].
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13893
	^ selection.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13894
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13895
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13896
    targetID == (display atomIDOf:#'TARGETS') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13897
	^ buffer
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13898
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13899
    targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13900
	"require libboss to be loaded"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13901
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13902
	    'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13903
	    ^ nil
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13904
	].
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13905
	^ (Object
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13906
	    readBinaryFrom:(ReadStream on:buffer)
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13907
	    onError:[:ex |
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13908
		('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13909
		nil
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13910
	    ])
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13911
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13912
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13913
    '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
 13914
    ' buffer:' infoPrint. buffer infoPrintCR.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13915
    ^ nil
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13916
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13917
    "Modified: / 23-08-2006 / 15:56:04 / cg"
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13918
    "Modified (format): / 08-10-2017 / 08:45:59 / cg"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13919
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13920
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13921
!XWorkstation::SelectionFetcher methodsFor:'event handling'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13922
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13923
message:aMessage
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13924
    "got an asynchronous event from the display.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13925
     Save and wake up waiters"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13926
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13927
    aMessage selector == #propertyChange:property:state:time: ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13928
	(aMessage arguments at:2) ~~ propertyID ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13929
	    "I am only interested in changes of the property used to
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13930
	     store the selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13931
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13932
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13933
	message notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13934
	    "this should not happen - bad selection holder?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13935
	    'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13936
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13937
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13938
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13939
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13940
    "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
 13941
     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
 13942
     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
 13943
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13944
    message := aMessage.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13945
    sema signal.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13946
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13947
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13948
propertyChange:aView property:aPropertyId state:stateSymbol time:time
8266
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13949
    "this is a forwarded propertyChange event from XWorkstation"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13950
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13951
    |property propertyValue|
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13952
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13953
    incremental ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13954
	"ignore property changes until we are in incremental mode"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13955
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13956
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13957
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13958
    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
 13959
    propertyValue := property value.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13960
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13961
    propertyValue size == 0 ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13962
	"property with size 0 signals end of transfer"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13963
	done := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13964
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13965
	buffer isNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13966
	    targetID := property key.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13967
	    buffer := propertyValue.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13968
	] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13969
	    targetID ~= property key ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13970
		'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13971
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13972
	    buffer := buffer, propertyValue.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13973
	].
8266
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13974
    ].
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13975
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13976
    "Modified (comment): / 25-01-2018 / 19:01:10 / mawalch"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13977
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13978
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13979
selectionClear:aView selection:selectionId time:time
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13980
    "sent when another X-client has created a selection.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13981
     This is a very X-specific mechanism."
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13982
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13983
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13984
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
 13985
    "this is a forwarded selectionNotify event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13986
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13987
    |property propertyKey atomName|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13988
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13989
    aSelectionID ~~ selectionID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13990
	"ignore notification that is not for our selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13991
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13992
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13993
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13994
    aPropertyID == 0 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13995
	"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
 13996
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13997
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13998
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13999
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14000
    property := display getProperty:aPropertyID from:drawableID delete:true.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 14001
    property isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14002
	"the property does not exist in the specified window"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14003
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14004
	^ self
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 14005
    ].
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 14006
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14007
    propertyKey := property key.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14008
    propertyKey == aTargetID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14009
	"good, the property is consistent with our request.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14010
	 The whole selection is in the property"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14011
	buffer := property value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14012
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14013
    ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14014
	"this is an incremental transfer. Wait for property change"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14015
	incremental := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14016
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14017
	atomName := (display atomName:propertyKey) ? propertyKey.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14018
	'XWorkstation(error): unexpected targetID (' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14019
	atomName errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14020
	') in selectionNotify: ' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14021
	display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 14022
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14023
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14024
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14025
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14026
!XWorkstation::SelectionFetcher methodsFor:'selection actions'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14027
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14028
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
 14029
    "request the selection of type targetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14030
     Wait for next asynchronous message and process it,
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14031
     until done"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14032
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14033
    display := aDisplay.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14034
    drawableID := aDrawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14035
    selectionID := aSelectionId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14036
    propertyID := display atomIDOf:#'VT_SELECTION'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14037
    targetID := aTargetId.
8070
26577d2836ff #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 8062
diff changeset
 14038
    sema := Semaphore name:'X11SelectionFetcher'.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14039
    done := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14040
    incremental := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14041
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14042
    [
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14043
	|timeout|
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14044
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14045
	display registerSelectionFetcher:self.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14046
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14047
	display
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14048
	    requestSelection:aSelectionId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14049
	    type:aTargetId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14050
	    for:drawableID
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14051
	    intoProperty:propertyID.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14052
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14053
	timeout := display xlibTimeout.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14054
	[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14055
	    |currentMessage|
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14056
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14057
	    (sema waitWithTimeout:timeout) isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14058
		"the selection owner didn't respond within reasonable time"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14059
		'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14060
		^ nil.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14061
	    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14062
	    currentMessage := message.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14063
	    message := nil.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14064
	    currentMessage notNil ifTrue:[currentMessage sendTo:self].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14065
	] doUntil:[done].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14066
    ] ensure:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 14067
	display unregisterSelectionFetcher:self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14068
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14069
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14070
    ^ self getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14071
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14072
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14073
!XWorkstation::SelectionFetcher methodsFor:'testing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14074
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14075
matchesDrawableId:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 14076
    "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
 14077
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14078
    ^ drawableID = aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14079
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 14080
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14081
!XWorkstation::WindowGroupWindow class methodsFor:'documentation'!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14082
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14083
documentation
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14084
"
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 14085
    A special window to serve as window group id.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 14086
    This window is never mapped.
8350
470b52f7ae31 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
 14087
    This window is used in XWMHints & _NET_WM_LEADER properties
470b52f7ae31 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
 14088
    to define the application window group
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14089
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14090
    [author:]
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 14091
	Jan Vrany <jan.vrany@fit.cvut.cz>
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14092
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14093
    [instance variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14094
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14095
    [class variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14096
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14097
    [see also:]
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 14098
	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
 14099
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14100
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14101
"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14102
! !
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 14103
6291
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 14104
!XWorkstation::WindowGroupWindow methodsFor:'testing'!
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 14105
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 14106
isICCCWindowGroupWindow
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 14107
    ^ true
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 14108
! !
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 14109
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 14110
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14111
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14112
version
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 14113
    ^ '$Header$'
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14114
!
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 14115
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 14116
version_CVS
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 14117
    ^ '$Header$'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14118
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 14119
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
 14120
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 14121
XWorkstation initialize!