XWorkstation.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Oct 2018 02:46:26 +0200
changeset 8549 908351f143a1
parent 8475 e1e3fa52dac0
child 8562 6a0b4f5f2f63
permissions -rw-r--r--
#FEATURE by cg class: WindowEvent::WidgetSelectionWindowEvent class definition
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
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    22
		hasRenderExtension hasXftLibrary ignoreBackingStore blackpixel
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    23
		whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    24
		quitAppAtom primaryAtom clipboardAtom stringAtom wmStateAtom
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    25
		motifWMHintsAtom listOfXFonts buttonsPressed eventRootX
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    26
		eventRootY displayName eventTrace dispatchingExpose rgbVisual
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    27
		rgbaVisual virtualRootId rootId altModifierMask metaModifierMask
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    28
		lastEventTime rawMonitorBounds monitorBounds lastButtonPressTime
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
    29
		lastButtonPressPosition deviceIOTimeoutErrorSignal
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    30
		activateOnClick rawKeySymTranslation clipboardSelectionTime
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    31
		primarySelectionTime selectionFetchers selectionHandlers
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    32
		preWaitAction xlibTimeout xlibTimeoutForWindowCreation
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    33
		hasConnectionBroken uniqueDeviceID stxDeviceAtom uuidAtom
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    34
		primaryBuffer windowGroupWindow maxOperationsUntilFlush
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
    35
		operationsUntilFlush lastError'
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    36
	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    37
		DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    38
		ErrorDBCache'
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    39
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    40
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    41
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    42
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    43
Object subclass:#PseudoDeviceWithoutXFTSupport
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    44
	instanceVariableNames:'realDevice'
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    45
	classVariableNames:''
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    46
	poolDictionaries:''
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    47
	privateIn:XWorkstation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    48
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
    49
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    50
Object subclass:#SelectionFetcher
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    51
	instanceVariableNames:'sema message display drawableID selectionID propertyID targetID
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    52
		buffer done incremental'
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    53
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    54
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    55
	privateIn:XWorkstation
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    56
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
    57
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    58
SimpleView subclass:#WindowGroupWindow
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    59
	instanceVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    60
	classVariableNames:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    61
	poolDictionaries:''
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
    62
	privateIn:XWorkstation
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    63
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
    64
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    65
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    66
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    67
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    68
#define SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
    69
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    70
#ifdef LINUX
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    71
# ifndef __arm__
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    72
#  define SHM
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
    73
# endif
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    74
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    75
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    76
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    77
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    78
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    79
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    80
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    81
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    82
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    83
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    84
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    85
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    86
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    87
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    88
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    89
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    90
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    91
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    92
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    93
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    94
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    95
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    96
 * 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
    97
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    98
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    99
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
   100
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   101
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   102
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   103
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
   104
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   105
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
#include <stdio.h>
5989
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   107
6041
cd2da50a737c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   108
#if defined(__osx__)
5989
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   109
# include <malloc/malloc.h>
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   110
extern void *malloc();
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   111
#else
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   112
# ifndef FREEBSD
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   113
#  include <malloc.h>
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
   114
# endif
5528
42447013fbc6 freebsd
Michael Beyl <mb@exept.de>
parents: 5525
diff changeset
   115
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   116
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   117
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   118
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   119
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   120
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   121
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   122
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   123
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   124
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   125
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   126
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   127
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   128
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   129
extern OBJ __GLOBAL_GET_BY_NAME(char *);
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   130
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   131
# define __HANDLE_VAL(type, externalAddress) \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   132
	((type)__externalAddressVal(externalAddress))
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   133
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   134
# define __HANDLE_NEW(ptr, __cls)                    \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   135
	({                                           \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   136
	    OBJ handle = __MKEXTERNALADDRESS(ptr);   \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   137
	    OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   138
	    __InstPtr(handle)->o_class = clsObj;     \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   139
	    __STORE(handle, clsObj);                 \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   140
	    handle;                                  \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   141
	})
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
   142
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   143
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   144
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   145
 * 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
   146
 * 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
   147
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   148
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   149
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
   150
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   151
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
   152
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
   153
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   154
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
   155
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   156
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   157
48194c26a46c Initial revision
claus
parents:
diff changeset
   158
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   159
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   161
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   162
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   163
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   164
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   165
48194c26a46c Initial revision
claus
parents:
diff changeset
   166
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   167
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   168
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   169
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   170
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   171
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   172
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   173
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   174
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   175
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   176
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   177
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   178
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   179
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   180
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   181
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   182
/*
186
claus
parents: 180
diff changeset
   183
 * PEX extension - if available
claus
parents: 180
diff changeset
   184
 */
claus
parents: 180
diff changeset
   185
#ifdef PEX5
claus
parents: 180
diff changeset
   186
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   187
#endif
claus
parents: 180
diff changeset
   188
claus
parents: 180
diff changeset
   189
/*
claus
parents: 180
diff changeset
   190
 * XImage extension - if available
claus
parents: 180
diff changeset
   191
 */
claus
parents: 180
diff changeset
   192
#ifdef XIE
claus
parents: 180
diff changeset
   193
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   194
#endif
claus
parents: 180
diff changeset
   195
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   196
/*
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   197
 * multiscreen extension - if available
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   198
 */
5865
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   199
#ifdef XINERAMA
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   200
# include <X11/extensions/Xinerama.h>
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   201
#endif
35046414f412 added: #queryXINERAMAExtension
Stefan Vogel <sv@exept.de>
parents: 5864
diff changeset
   202
186
claus
parents: 180
diff changeset
   203
/*
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   204
 * XCURSOR extension - if available
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   205
 */
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   206
#ifdef XCURSOR
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   207
# include <X11/Xcursor/Xcursor.h>
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   208
#endif
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   209
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
   210
/*
6159
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   211
 * xft library (based on RENDER extension) - if available
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   212
 */
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   213
#ifdef XFT
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   214
# 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
   215
# 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
   216
# include <X11/extensions/render.h>
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   217
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   218
# define XFT_FONT(x)            __HANDLE_VAL(XftFont*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   219
# define XFT_FONT_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftFontHandle")
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   220
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   221
# define XFT_DRAW(x)            __HANDLE_VAL(XftDraw*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   222
# define XFT_DRAW_HANDLE_NEW(x) __HANDLE_NEW(x, "XftFontDescription::XftDrawHandle")
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   223
#endif // XFT
6159
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   224
d4e463e0c56c preps for xft
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
   225
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   226
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   227
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   228
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   229
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   230
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   231
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   232
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   233
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   234
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   235
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   236
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   237
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   238
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   239
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   240
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   241
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   242
 * if nformats cannot be found in the Display structure ...
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   243
 */
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   244
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   245
#endif
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 defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   248
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   249
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   250
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   251
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   252
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   253
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   254
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   255
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   256
# define DISPLAY(x)    __HANDLE_VAL(Display*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   257
# define SCREEN(x)     ((int)(__intVal(x)))
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   258
# define DRAWABLE(x)   __HANDLE_VAL(Drawable, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   259
# define GC(x)         __HANDLE_VAL(GC, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   260
# define VISUAL(x)     __HANDLE_VAL(Visual*, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   261
# define COLORMAP(x)   __HANDLE_VAL(Colormap, x)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   262
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   263
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   264
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   265
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   266
 */
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   267
#define __DisplayVal(o)      (Display *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   268
#define __DrawableVal(o)     (Drawable)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   269
#define __WindowVal(o)       (Window)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   270
#define __PixmapVal(o)       (Pixmap)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   271
#define __GCVal(o)           (GC)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   272
#define __CursorVal(o)       (Cursor)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   273
#define __FontVal(o)         (XFontStruct *)(__externalAddressVal(o))
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   274
#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
   275
3693
b01b0cd76a61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3670
diff changeset
   276
#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
   277
#define __AtomVal(o)         __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   278
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   279
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
   280
#define myDpy                __DisplayVal(__INST(displayId))
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   281
#define ISCONNECTED          ((__INST(displayId) != nil) && (__INST(hasConnectionBroken) != nil))
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   282
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   283
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   284
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   285
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   286
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   287
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   288
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   289
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   290
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   291
/*
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   292
 * these two macros should be placed around X-lib calls,
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   293
 * which may block due to a broken connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   294
 * They setup/remove a VM-timeout which raises an exception
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   295
 * after xlibTimeout seconds.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   296
 * This exception will shutDown the connection.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   297
 * Q: is this a good idea for the local display ?
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   298
 */
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   299
#define __ENTER_XLIB(whichTimeout)   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   300
    { \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   301
	__blockingPrimitiveTimoutHandler__ = (voidFUNC)__XTimeoutErrorHandler; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   302
	__blockingPrimitiveTimeoutArg__ = self; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   303
	__blockingPrimitiveTimeout__ = whichTimeout; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   304
    } {
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   305
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   306
#define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   307
    { \
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   308
	__blockingPrimitiveTimoutHandler__ = (voidFUNC)0; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   309
	__blockingPrimitiveTimeoutArg__ = nil; \
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   310
	__blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   311
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   312
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   313
#define ENTER_XLIB()   __ENTER_XLIB(__intVal(__INST(xlibTimeout)) * 1000)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   314
#define ENTER_XLIB2()  __ENTER_XLIB(__intVal(__INST(xlibTimeoutForWindowCreation)) * 1000)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   315
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   316
#ifdef SUPPORT_MOTIF_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   317
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   318
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   319
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   320
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   321
# ifndef MWM_HINTS_FUNCTIONS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   322
#  define MWM_HINTS_FUNCTIONS       (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   323
#  define MWM_HINTS_DECORATIONS     (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   324
#  define MWM_HINTS_INPUT_MODE      (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   325
#  define MWM_HINTS_STATUS          (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   326
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   327
#  define MWM_FUNC_ALL              (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   328
#  define MWM_FUNC_RESIZE           (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   329
#  define MWM_FUNC_MOVE             (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   330
#  define MWM_FUNC_MINIMIZE         (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   331
#  define MWM_FUNC_MAXIMIZE         (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   332
#  define MWM_FUNC_CLOSE            (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   333
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   334
#  define MWM_INPUT_MODELESS                      0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   335
#  define MWM_INPUT_PRIMARY_APPLICATION_MODAL     1
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   336
#  define MWM_INPUT_SYSTEM_MODAL                  2
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   337
#  define MWM_INPUT_FULL_APPLICATION_MODAL        3
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_DECOR_NONE            0
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   340
#  define MWM_DECOR_ALL             (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   341
#  define MWM_DECOR_BORDER          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   342
#  define MWM_DECOR_RESIZEH         (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   343
#  define MWM_DECOR_TITLE           (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   344
#  define MWM_DECOR_MENU            (1L << 4)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   345
#  define MWM_DECOR_MINIMIZE        (1L << 5)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   346
#  define MWM_DECOR_MAXIMIZE        (1L << 6)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   347
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   348
#endif /* SUPPORT_MOTIF_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   349
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   350
/*
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   351
 * openlook hints are not supported yet
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   352
 * - noone needs them anymore ;-(
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   353
 */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   354
#ifdef SUPPORT_OPENLOOCK_WM_HINTS
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   355
# ifdef SOME_MACHINE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   356
#  include <anIncludeFileWhichDefinesTheStuffBelow>
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   357
# endif
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
# ifndef OL_DECOR_CLOSE
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   360
#  define OL_DECOR_CLOSE            (1L << 0)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   361
#  define OL_DECOR_RESIZEH          (1L << 1)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   362
#  define OL_DECOR_HEADER           (1L << 2)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   363
#  define OL_DECOR_ICON_NAME        (1L << 3)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   364
#  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
   365
#  define OL_ANY_HINTS              (1L << 7)
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   366
# endif
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   367
#endif /* SUPPORT_OPENLOOCK_WM_HINTS */
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
   368
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
   369
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   370
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   371
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   372
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   373
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   374
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   375
/*
146
claus
parents: 145
diff changeset
   376
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   377
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   378
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   379
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   380
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   381
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   382
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   383
static int __debug__ = 0;
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   384
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   385
#define DPRINTF(x)      if (__debug__) { console_printf x; }
3468
b7e913629327 printf -> fprintf
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   386
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   387
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   388
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   389
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   390
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   391
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   392
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   393
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   394
 * 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
   395
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   396
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   397
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   398
# ifdef __GNUC__
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   399
VOLATILE
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   400
# endif
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
   401
static void
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   402
dummyToForceLoading() {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   403
	XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   404
	XCloseDisplay(0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   405
	XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   406
	XSetWindowColormap(0, 0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   407
	XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   408
# ifdef SHM
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   409
	XShmAttach(0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   410
	XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   411
	XShmDetach(0, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   412
	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
   413
	shmctl(0,0,0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   414
	fgetc(0);
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   415
# endif  // SHM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   416
}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   417
#endif // !ELF
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   418
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   419
static char* requestNames[] = {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   420
    "X_CreateWindow",               // 0
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   421
    "X_ChangeWindowAttributes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   422
    "X_GetWindowAttributes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   423
    "X_DestroyWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   424
    "X_DestroySubwindows",          // 4
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   425
    "X_ChangeSaveSet",              // 5
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   426
    "X_ReparentWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   427
    "X_MapWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   428
    "X_MapSubwindows",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   429
    "X_UnmapWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   430
    "X_UnmapSubwindows",            // 10
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   431
    "X_ConfigureWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   432
    "X_CirculateWindow",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   433
    "X_GetGeometry",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   434
    "X_QueryTree",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   435
    "X_InternAtom",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   436
    "X_GetAtomName",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   437
    "X_ChangeProperty",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   438
    "X_DeleteProperty",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   439
    "X_GetProperty",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   440
    "X_ListProperties",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   441
    "X_SetSelectionOwner",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   442
    "X_GetSelectionOwner",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   443
    "X_ConvertSelection",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   444
    "X_SendEvent",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   445
    "X_GrabPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   446
    "X_UngrabPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   447
    "X_GrabButton",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   448
    "X_UngrabButton",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   449
    "X_ChangeActivePointerGrab",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   450
    "X_GrabKeyboard",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   451
    "X_UngrabKeyboard",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   452
    "X_GrabKey",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   453
    "X_UngrabKey",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   454
    "X_AllowEvents",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   455
    "X_GrabServer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   456
    "X_UngrabServer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   457
    "X_QueryPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   458
    "X_GetMotionEvents",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   459
    "X_TranslateCoords",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   460
    "X_WarpPointer",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   461
    "X_SetInputFocus",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   462
    "X_GetInputFocus",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   463
    "X_QueryKeymap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   464
    "X_OpenFont",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   465
    "X_CloseFont",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   466
    "X_QueryFont",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   467
    "X_QueryTextExtents",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   468
    "X_ListFonts",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   469
    "X_ListFontsWithInfo",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   470
    "X_SetFontPath",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   471
    "X_GetFontPath",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   472
    "X_CreatePixma",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   473
    "X_FreePixmap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   474
    "X_CreateGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   475
    "X_ChangeGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   476
    "X_CopyGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   477
    "X_SetDashes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   478
    "X_SetClipRectangles",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   479
    "X_FreeGC",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   480
    "X_ClearArea",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   481
    "X_CopyArea",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   482
    "X_CopyPlane",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   483
    "X_PolyPoint",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   484
    "X_PolyLine",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   485
    "X_PolySegment",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   486
    "X_PolyRectangle",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   487
    "X_PolyArc",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   488
    "X_FillPoly",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   489
    "X_PolyFillRectangle",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   490
    "X_PolyFillArc",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   491
    "X_PutImage",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   492
    "X_GetImage",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   493
    "X_PolyText8",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   494
    "X_PolyText16",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   495
    "X_ImageText8",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   496
    "X_ImageText16",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   497
    "X_CreateColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   498
    "X_FreeColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   499
    "X_CopyColormapAndFree",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   500
    "X_InstallColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   501
    "X_UninstallColormap",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   502
    "X_ListInstalledColormaps",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   503
    "X_AllocColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   504
    "X_AllocNamedColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   505
    "X_AllocColorCells",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   506
    "X_AllocColorPlanes",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   507
    "X_FreeColors",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   508
    "X_StoreColors",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   509
    "X_StoreNamedColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   510
    "X_QueryColors",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   511
    "X_LookupColor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   512
    "X_CreateCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   513
    "X_CreateGlyphCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   514
    "X_FreeCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   515
    "X_RecolorCursor",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   516
    "X_QueryBestSize",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   517
    "X_QueryExtension",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   518
    "X_ListExtensions",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   519
    "X_ChangeKeyboardMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   520
    "X_GetKeyboardMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   521
    "X_ChangeKeyboardControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   522
    "X_GetKeyboardControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   523
    "X_Bell",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   524
    "X_ChangePointerControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   525
    "X_GetPointerControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   526
    "X_SetScreenSaver",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   527
    "X_GetScreenSaver",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   528
    "X_ChangeHosts",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   529
    "X_ListHosts",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   530
    "X_SetAccessControl",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   531
    "X_SetCloseDownMode",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   532
    "X_KillClient",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   533
    "X_RotateProperties",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   534
    "X_ForceScreenSaver",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   535
    "X_SetPointerMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   536
    "X_GetPointerMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   537
    "X_SetModifierMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   538
    "X_GetModifierMapping",
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   539
};
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
   540
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   541
#if !defined(__INCREMENTAL_COMPILE__)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   542
// __myInstPtr has been redefined/overwritten by private classes - restore
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   543
#undef __myInstPtr
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   544
#define __myInstPtr(obj) ((struct __XWorkstation_struct *)(obj))
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   545
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   546
/*
144
claus
parents: 143
diff changeset
   547
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   548
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   549
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   550
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   551
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   552
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   553
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   554
int
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   555
__XErrorHandler__(Display *dpy, XErrorEvent *event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   556
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   557
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   558
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   559
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   560
    if (lastErrorMsg[0] == '\0') {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   561
	sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   562
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   563
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   564
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   565
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   566
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   567
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   568
	 * this is a BadWindow error for X_DestroyWindow.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   569
	 * ignore it here, since it results from the GC freeing windows
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   570
	 * in non bottom-up window order.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   571
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   572
	return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   573
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   574
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   575
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   576
	char *requestName = "?";
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   577
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   578
	if (event->request_code < (sizeof(requestNames)/sizeof(char *))) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   579
	    requestName = requestNames[event->request_code];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   580
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   581
	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
   582
			event->request_code, event->request_code, requestName,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   583
			event->minor_code, event->minor_code, (INT)(event->resourceid));
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   584
	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
   585
			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
   586
    }
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
   587
#if 0
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
   588
    // 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
   589
#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
   590
    if ((strncmp(lastErrorMsg, "RenderBadPicture", 16) == 0)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   591
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   592
	 * this is a RenderBadPicture error from XFT drawing.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   593
	 * 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
   594
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   595
	console_fprintf(stderr, "XWorkstation [info]: x-error ignored\n");
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   596
	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
   597
    }
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   598
#endif
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
   599
#endif
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   600
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   601
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   602
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   603
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   604
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   605
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   606
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   607
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   608
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   609
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   610
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   611
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   612
int
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   613
__XIOErrorHandler__(Display *dpy)
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   614
{
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   615
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   616
	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
   617
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   618
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   619
						  __MKEXTERNALADDRESS(dpy));
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   620
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   621
#if 0
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   622
    /*
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   623
     * don't do this.
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   624
     * 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
   625
     */
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   626
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   627
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   628
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   629
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   630
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   631
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   632
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   633
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   634
    /* never reached */
3207
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   635
#endif
df242f652d1f More error handling
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   636
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   637
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   638
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   639
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   640
/*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   641
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   642
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   643
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   644
 * timeoutHandler has been set.
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
void
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   647
__XTimeoutErrorHandler(OBJ displayDeviceInst)
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   648
{
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   649
    if ((displayDeviceInst == @global(MainDisplay))
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   650
	|| (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   651
	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
   652
	return;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   653
    }
4640
edde8a16e07d Fix classvar refs in primitive functions.
Stefan Vogel <sv@exept.de>
parents: 4636
diff changeset
   654
    if (@global(DeviceWorkstation:ErrorPrinting) == true) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   655
	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
   656
    }
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   657
    __OINST(displayDeviceInst, hasConnectionBroken) = true;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   658
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   659
    __PROTECT__(displayDeviceInst);
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   660
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
4635
ad449b8058fe Fix for __XTimeoutErrorHandler__: __PROTECT__(displayDeviceInst)
Stefan Vogel <sv@exept.de>
parents: 4631
diff changeset
   661
    __UNPROTECT__(displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   662
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   663
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   664
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   665
     */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   666
    if (__OINST(displayDeviceInst, displayId) != nil) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   667
	__internalError("unhandled X11 display timeout error");
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   668
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   669
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   670
	 * the current process failed to do an X11 request.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   671
	 * Terminate it!
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   672
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   673
	__terminateProcess(0);      /* soft terminate */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   674
	__terminateProcess(1);      /* hard terminate */
3206
61414144918b More error handling
Stefan Vogel <sv@exept.de>
parents: 3205
diff changeset
   675
    }
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   676
}
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
   677
#endif // __INCREMENTAL_COMPILE__
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   678
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   679
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   680
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   681
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   682
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   683
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   684
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   685
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   686
COPYRIGHT (c) 1989 by Claus Gittinger
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   687
	      All Rights Reserved
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
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   690
 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
   691
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   692
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   693
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   694
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   695
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   696
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   697
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   698
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   699
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   700
    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
   701
    from DeviceWorkstation.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   702
    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
   703
    in theory (and in our practice), you can create Views on many displays
7507
cb7c25da60d0 #OTHER by mawalch
mawalch
parents: 7506
diff changeset
   704
    simultaneously. However, the default setup is for one display only.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   705
    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
   706
    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
   707
    different protocol (ApplicationModel openOnDevice:) or by temporarily answering
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   708
    the other device to the currentScreen query.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   709
    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
   710
    query is answered by the launcher when opening its applications.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   711
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   712
    Timeouts:
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   713
	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
   714
	default, this would lead to a locked ST/X system.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   715
	Therefore, this class defines a timeOut, whenever doing an Xlib call.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   716
	The default for this timeout is 30seconds.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   717
	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
   718
	when creating windows.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   719
	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
   720
	a timeout and closes the connection.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   721
	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
   722
	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
   723
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   724
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   725
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   726
    [author:]
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
   727
	Claus Gittinger
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
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   730
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   731
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   732
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   733
initialize
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
   734
    "/ ConservativeSync is required for some Xlib implementation,
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
   735
    "/ 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
   736
    "/ (especially Win32 & Xlib)
6363
1695f666d823 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6350
diff changeset
   737
    ConservativeSync := OperatingSystem isMSWINDOWSlike.
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   738
3267
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   739
    "/ some XServers crash, when given too long strings in XDrawString/XDrawInageString.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   740
    "/ the following is an adjustable soft-limit.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   741
    MaxStringLength := 4096.
de85f7d8dc5f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3263
diff changeset
   742
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   743
    "/ 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
   744
    DefaultXLibTimeout := 30.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   745
    DefaultXLibTimeoutForWindowCreation := 5*60.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   746
3321
3d0e6754dcd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   747
    RawKeySymTranslation isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   748
	"/ the following table maps X-keyevents to ST/X
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   749
	"/ device independend events.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   750
	"/ It is NOT meant as a keyboardMap replacement.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   751
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   752
	RawKeySymTranslation := Dictionary new:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   753
	RawKeySymTranslation
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   754
	    at:#'Delete_line' put:#DeleteLine;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   755
	    at:#'Delete_word' put:#DeleteWord;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   756
	    at:#Down put:#CursorDown;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   757
	    at:#Up put:#CursorUp;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   758
	    at:#Left put:#CursorLeft;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   759
	    at:#Right put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   760
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   761
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   762
    "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
   763
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   764
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   765
!XWorkstation class methodsFor:'accessing-display capabilities'!
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   766
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   767
hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   768
%{
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   769
#ifdef XCURSOR
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   770
    RETURN(true);
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   771
#else
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   772
    RETURN(false);
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   773
#endif
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   774
%}
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   775
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   776
     Display hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   777
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   778
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
   779
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   780
hasXftLibrary
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   781
%{
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   782
#ifdef XFT
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   783
    RETURN(true);
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   784
#else
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   785
    RETURN(false);
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   786
#endif
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   787
%}
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   788
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   789
     Display hasXftLibrary
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   790
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   791
! !
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
   792
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   793
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   794
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   795
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   796
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   797
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   798
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   799
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   800
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   801
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   802
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   803
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   804
#ifdef COUNT_RESOURCES
4723
ad10f05ff89b printf -> console_printf
Claus Gittinger <cg@exept.de>
parents: 4711
diff changeset
   805
    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
   806
	    __cnt_color, __cnt_bitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   807
	    __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
   808
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   809
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   810
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   811
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   812
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   813
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   814
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   815
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   816
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   817
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   818
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   819
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   820
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   821
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   822
getConnectionTimeOut
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   823
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   824
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   825
    ^ DefaultXLibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   826
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   827
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   828
getConnectionTimeOutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   829
    "returns the default connectionTimeOut (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   830
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   831
    ^ DefaultXLibTimeoutForWindowCreation
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   832
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   833
135
claus
parents: 133
diff changeset
   834
lastErrorString
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   835
    "return the last X-error string -
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   836
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   837
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   838
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   839
    |string s match line requestCode|
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   840
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   841
    string := self errorStringOfLastError.
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   842
    requestCode := self requestCodeOfLastError.
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   843
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   844
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   845
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   846
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   847
    "
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   848
    match := 'XRequest.' , requestCode printString.
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   849
    ErrorDBCache isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   850
	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
   851
    ].
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   852
62b008701d53 temporary hack fix: ignore XRender errors due to invalid use of Picture/GC
Claus Gittinger <cg@exept.de>
parents: 6224
diff changeset
   853
    "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
   854
    line := ErrorDBCache at:requestCode ifAbsentPut:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   855
	    |errorLine|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   856
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   857
	    s := '/usr/share/X11/XErrorDB' asFilename readStreamOrNil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   858
	    s notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   859
		errorLine := s peekForLineStartingWith:match.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   860
		errorLine notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   861
		    errorLine := errorLine copyFrom:(errorLine indexOf:$:)+1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   862
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   863
		s close.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   864
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   865
	    errorLine
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   866
	].
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   867
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   868
    line isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   869
	line := match
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   870
    ].
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   871
    ^ string , ' in ' , line.
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   872
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   873
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   874
	Screen lastErrorString
6214
14574c9caac6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6177
diff changeset
   875
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   876
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   877
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   878
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   879
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   880
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   881
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   884
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   885
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   886
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   887
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   888
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   889
%}
135
claus
parents: 133
diff changeset
   890
!
claus
parents: 133
diff changeset
   891
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   892
resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   893
%{  /* NOCONTEXT */
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   894
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   895
      if (lastResource != 0) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   896
	 RETURN ( __MKEXTERNALADDRESS(lastResource) );
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   897
      }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   898
%}.
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
     ^ nil
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   901
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
     "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
   904
	 Screen resourceIdOfLastError
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
   905
     "
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   906
!
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   907
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   908
setConnectionTimeOut:seconds
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   909
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   910
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   911
    DefaultXLibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   912
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   913
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   914
setConnectionTimeOutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   915
    "set the default connection timeout (seconds)"
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   916
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
   917
    DefaultXLibTimeoutForWindowCreation := seconds
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   918
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   919
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   920
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   921
7086
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   922
isX11Platform
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   923
    ^ true
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   924
!
2c3d25b893b5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 7022
diff changeset
   925
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   926
platformName
133
claus
parents: 132
diff changeset
   927
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   928
     Return a string describing the display systems platform.
5036
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   929
     XWorkstation always returns #X11."
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   930
62bd216d3daf #platfromName - use symbol
Stefan Vogel <sv@exept.de>
parents: 5034
diff changeset
   931
    ^ #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
   932
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   933
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   934
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   935
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   936
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   937
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   938
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   939
    "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
   940
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   941
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   942
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   943
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   944
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   945
!XWorkstation methodsFor:'accessing'!
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   946
6177
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   947
displayId
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   948
    ^ displayId
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   949
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   950
    "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
   951
!
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   952
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   953
displayIdOrErrorIfBroken
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   954
    (hasConnectionBroken or:[displayId isNil]) ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
   955
	self primitiveFailedOrClosedConnection.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
   956
	^ nil.
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   957
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   958
    ^ displayId
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   959
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   960
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   961
displayIdOrNilIfBroken
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   962
    hasConnectionBroken ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
   963
	^ nil.
6332
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
    ^ displayId
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   966
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
   967
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   968
maxOperationsUntilFlush
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   969
    ^ maxOperationsUntilFlush
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   970
!
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   971
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   972
maxOperationsUntilFlush:anIntegerOrNil
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   973
    "if not nil, after anInteger number of draw operations
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   974
     a flush is performed.
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   975
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   976
     This is to work around a drawing problem which occurs on
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   977
     Ubuntu 12.04 64bit running on a VMware player (2013-11)."
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   978
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
   979
    maxOperationsUntilFlush := anIntegerOrNil.
6177
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   980
!
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   981
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   982
screen
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   983
    ^ screen
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   984
53a2b3f77dd3 class: XWorkstation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6172
diff changeset
   985
    "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
   986
! !
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
   987
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   988
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   989
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   990
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   991
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   992
     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
   993
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   994
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   995
     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
   996
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   997
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   998
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   999
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1000
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1001
    prev := activateOnClick ? false.
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1002
    aBoolean notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1003
	activateOnClick := aBoolean.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1004
    ].
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1005
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1006
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1007
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1008
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1009
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1010
    "
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
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1013
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1014
    "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
  1015
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1016
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1017
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1018
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1019
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1020
    ^ nil
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
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1023
asPseudoDeviceWithoutXFTSupport
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1024
    "return a pseudo device to be used when drawing into pixmaps
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1025
     on a device where xft-drawing into pixmaps is broken.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1026
     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
  1027
     then, we should return self here."
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  1028
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1029
    ^ PseudoDeviceWithoutXFTSupport basicNew realDevice:self
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1030
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
  1031
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1032
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1033
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1034
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1035
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1036
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1037
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1038
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1039
    "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
  1040
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1041
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1042
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1043
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1044
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1045
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1046
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1047
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1048
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1049
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1050
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1051
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1052
    "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
  1053
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1054
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1055
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1056
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1057
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1058
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1059
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1060
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1061
    "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
  1062
     For backward compatibility."
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
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1065
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1066
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1067
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1068
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1069
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1070
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1071
     This is the devices mask."
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
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1074
    if (aButton == __MKSMALLINT(1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1075
	RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1076
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1077
    if (aButton == __MKSMALLINT(2)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1078
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1079
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1080
    if (aButton == __MKSMALLINT(3)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1081
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1082
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1083
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1084
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1085
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1086
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1087
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1088
    "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
  1089
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1090
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1091
    ^ self ctrlModifierMask
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1092
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1093
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1094
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1095
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1096
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
  1097
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1098
48194c26a46c Initial revision
claus
parents:
diff changeset
  1099
%{  /* NOCONTEXT */
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1100
#ifndef __win32__
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1101
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1102
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1103
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1104
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1105
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1106
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1107
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1108
133
claus
parents: 132
diff changeset
  1109
displayName
claus
parents: 132
diff changeset
  1110
    "return the X-connections display name.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1111
     This is (currently) nil for the default display,
133
claus
parents: 132
diff changeset
  1112
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
  1113
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
  1114
claus
parents: 132
diff changeset
  1115
    ^ displayName
claus
parents: 132
diff changeset
  1116
!
claus
parents: 132
diff changeset
  1117
4153
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1118
displayName: something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1119
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1120
    displayName := something
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1121
!
a6d682af620b *** empty log message ***
werner
parents: 4127
diff changeset
  1122
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1123
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1124
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1125
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1126
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1127
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1128
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1129
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1130
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1131
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1132
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1133
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1134
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1135
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1136
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1137
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1138
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1139
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1140
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1141
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1142
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1143
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1144
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1145
	RETURN ( __MKSTRING(XServerVendor(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 serverVendor
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1152
     Display platformName
341
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
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1156
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1157
    "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
  1158
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1159
    "/ obsolete
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  1160
    ^ self shiftModifierMask
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1161
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  1162
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1163
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1164
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1165
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1166
     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
  1167
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1168
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1169
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1170
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1171
    |x1 y1 x2 y2 rootWindowId|
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1172
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1173
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1174
    y1 := y2 := aPoint y truncated.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1175
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1176
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1177
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1178
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1179
    Window w1, w2, child_ret;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1180
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1181
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1182
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1183
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1184
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1185
     && __bothSmallInteger(x1, y1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1186
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1187
	Window rootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1188
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1189
	w1 = __WindowVal(windowId1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1190
	w2 = __WindowVal(windowId2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1191
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1192
	rootWin = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1193
	if (w1 == rootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1194
	    w1 = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1195
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1196
	if (w2 == rootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1197
	    w2 = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1198
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1199
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1200
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1201
	XTranslateCoordinates(dpy, w1, w2,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1202
			      __intVal(x1), __intVal(y1),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1203
			      &xpos, &ypos, &child_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1204
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1205
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1206
	x2 = __MKSMALLINT(xpos);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1207
	y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1208
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1209
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1210
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1211
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1212
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1213
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1214
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1215
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1216
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1217
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1218
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1219
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1220
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1221
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1222
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1223
    RETURN (nil);
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
     Display vendorRelease
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
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1231
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1232
    "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
  1233
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1234
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1235
     - 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
  1236
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1237
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1238
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1239
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1240
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1241
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1242
    int xpos, ypos;
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  1243
    Window child_ret;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1244
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1245
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1246
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1247
     && __isPoint(aPoint)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1248
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1249
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1250
	xp = _point_X(aPoint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1251
	yp = _point_Y(aPoint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1252
	if (__bothSmallInteger(xp, yp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1253
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1254
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1255
	    XTranslateCoordinates(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1256
				  RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1257
				  __WindowVal(windowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1258
				  __intVal(xp), __intVal(yp),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1259
				  &xpos, &ypos, &child_ret);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1260
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1261
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1262
	    if (child_ret) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1263
		RETURN ( __MKEXTERNALADDRESS(child_ret) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1264
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1265
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1266
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1267
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1268
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1269
    windowId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1270
	aPoint isPoint ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1271
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1272
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1273
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1274
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1275
    ^ nil
3412
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1276
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1277
    "
91fe6c42822d Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents: 3333
diff changeset
  1278
      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
  1279
    "
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1280
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1281
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1282
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1283
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1284
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1285
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1286
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1287
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1288
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1289
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1290
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1291
    if (ISCONNECTED
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1292
     && (__INST(rootId) != __INST(virtualRootId))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1293
     && __isExternalAddress(__INST(virtualRootId))) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1294
	Window vRootWin;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1295
	Window root;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1296
	int x, y;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1297
	unsigned int width, height;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1298
	unsigned int dummy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1299
	int ret;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1300
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1301
	vRootWin = __WindowVal(__INST(virtualRootId));
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1302
	ENTER_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1303
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1304
					  &dummy, &dummy);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1305
	LEAVE_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1306
	if (ret) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1307
	    RETURN ( __MKPOINT_INT(width, height) );
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  1308
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1309
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1310
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1311
    ^ width @ height
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1312
   "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1313
     Display virtualExtent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1314
     Display extent
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  1315
   "
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1316
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  1317
    "Modified: / 03-05-2018 / 16:30:51 / stefan"
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1318
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1319
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1320
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1321
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1322
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1323
    ^ whitepixel
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1324
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1325
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1326
xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1327
    ^ xlibTimeout
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1328
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1329
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1330
xlibTimeout:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1331
    xlibTimeout := seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1332
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1333
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1334
xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1335
    ^ xlibTimeoutForWindowCreation
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1336
!
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1337
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1338
xlibTimeoutForWindowCreation:seconds
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1339
    xlibTimeoutForWindowCreation := seconds
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1340
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1341
3263
bd92a12c9316 category changes
Claus Gittinger <cg@exept.de>
parents: 3250
diff changeset
  1342
!XWorkstation methodsFor:'accessing-display capabilities'!
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1343
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1344
extentOfResizeHandle
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1345
    "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
  1346
     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
  1347
     of the window.
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1348
     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
  1349
     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
  1350
     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
  1351
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1352
    OperatingSystem getOSType == #osx ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1353
	"/ 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
  1354
	"/ us a hint through the server vendor...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1355
	^ 16@16
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1356
    ].
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1357
    ^ 0@0
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1358
!
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
  1359
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1360
hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1361
    "return true, if this workstation supports the X cursor extension.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1362
     This extension allows for deep cursors (depth > 1)"
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1363
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1364
    ^ self hasExtension:'CURSOR'
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1365
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1366
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1367
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1368
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1369
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1370
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1371
hasDPS
186
claus
parents: 180
diff changeset
  1372
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
  1373
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
  1374
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1375
48194c26a46c Initial revision
claus
parents:
diff changeset
  1376
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
  1377
claus
parents: 180
diff changeset
  1378
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1379
     Display hasDPS
186
claus
parents: 180
diff changeset
  1380
    "
claus
parents: 180
diff changeset
  1381
!
claus
parents: 180
diff changeset
  1382
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1383
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1384
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1385
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
  1386
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
  1387
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1388
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1389
    <context: #return>
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1390
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1391
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1392
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1393
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1394
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1395
     && __isStringLike(extensionString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1396
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1397
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1398
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1399
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1400
	LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1401
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1402
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1403
%}
186
claus
parents: 180
diff changeset
  1404
claus
parents: 180
diff changeset
  1405
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1406
     Display hasExtension:'XVideo'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1407
     Display hasExtension:'Input'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1408
     Display hasExtension:'GLX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1409
     Display hasExtension:'X3D-PEX'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1410
     Display hasExtension:'XInputExtension'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1411
     Display hasExtension:'SHAPE'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1412
     Display hasExtension:'MIT-SHM'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1413
     Display hasExtension:'SGIFullScreenStereo'
186
claus
parents: 180
diff changeset
  1414
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1415
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1416
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1417
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1418
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1419
     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
  1420
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1421
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1422
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1423
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1424
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1425
     Display hasImageExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1426
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1427
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1428
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1429
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1430
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1431
     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
  1432
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1433
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1434
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1435
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1436
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1437
     Display hasInputExtension
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1438
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1439
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1440
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1441
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1442
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1443
     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
  1444
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1445
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1446
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1447
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1448
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1449
     Display hasMultibuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1450
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1451
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1452
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1453
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1454
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1455
     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
  1456
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1457
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1458
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1459
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1460
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1461
     Display hasPEX
295
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1464
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1465
hasRenderExtension
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1466
    "return true, if this workstation supports the X render extension."
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1467
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1468
    ^ self hasExtension:'RENDER'
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1469
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1470
    "
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1471
     Display hasRenderExtension
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1472
    "
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1473
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1474
8415
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1475
hasSaveUnder:aBoolean
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1476
    "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
  1477
     - this can be used on servers where saveUnder is
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1478
     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
  1479
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1480
    hasSaveUnder := aBoolean
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1481
8416
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1482
    "
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1483
     Screen current hasSaveUnder:false
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1484
    "
1e67817f20b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8415
diff changeset
  1485
8415
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1486
    "Created: / 22-06-2018 / 10:47:25 / Claus Gittinger"
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1487
!
1ab9a9ef361d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
  1488
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1489
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1490
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1491
     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
  1492
     enabled in the smalltalk system, for true to be returned."
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
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1495
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1496
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1497
     Display hasShm
295
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1500
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1501
hasXVideo
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1502
    "return true, if this workstation supports the XVideo extension.
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1503
     Both the server must support it, and the feature must have been
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1504
     enabled in the smalltalk system, for true to be returned."
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1505
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1506
    ^ hasXVideoExtension
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1507
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1508
    "
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1509
     Display hasXVideo
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1510
    "
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1511
!
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  1512
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1513
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1514
    "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
  1515
     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
  1516
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1517
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1518
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1519
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1520
7141
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1521
    count := 0.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1522
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1523
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1524
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1525
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1526
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1527
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1528
	Display *dpy = myDpy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1529
	int status;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1530
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1531
	ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1532
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1533
	LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1534
	if (status > 0) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1535
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1536
	   count = __MKSMALLINT(cnt);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1537
	}
7141
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1538
    }
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1539
%}.
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1540
    count == 0 ifTrue:[^ nil].
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1541
83d745d0d70f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7119
diff changeset
  1542
    ret := Array new:count.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1543
    1 to:count do:[ :i |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1544
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1545
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1546
%{
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1547
	XIconSize *slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1548
	minWidth = __MKSMALLINT(slp->min_width);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1549
	minHeight = __MKSMALLINT(slp->min_height);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1550
	maxWidth = __MKSMALLINT(slp->max_width);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1551
	maxHeight = __MKSMALLINT(slp->max_height);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1552
	widthStep = __MKSMALLINT(slp->width_inc);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1553
	heightStep = __MKSMALLINT(slp->height_inc);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1554
%}.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1555
	d := IdentityDictionary new:6.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1556
	d at:#minWidth put:minWidth.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1557
	d at:#maxWidth put:maxWidth.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1558
	d at:#widthStep put:widthStep.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1559
	d at:#minHeight put:minHeight.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1560
	d at:#maxHeight put:maxHeight.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1561
	d at:#heightStep put:heightStep.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1562
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1563
	ret at:i put:d.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1564
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1565
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1566
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1567
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1568
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1569
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1570
     Display iconSizes
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1571
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1572
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1573
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1574
ignoreBackingStore:aBoolean
7696
2e656340ab84 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7662
diff changeset
  1575
    "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
  1576
     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
  1577
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1578
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1579
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1580
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1581
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1582
monitorBounds
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  1583
    "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
  1584
     The first monitor returned is the primary monitor"
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1585
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1586
    |numberOfMonitors resultArray bounds|
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1587
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1588
%{
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1589
#ifdef XINERAMA
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1590
    if (ISCONNECTED && __INST(hasXineramaExtension) == true) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1591
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1592
	XineramaScreenInfo *screenInfo;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1593
	int numDisplays;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1594
	OBJ *cResultArray;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1595
	int i, ci;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1596
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1597
	screenInfo = XineramaQueryScreens (dpy, &numDisplays);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1598
	if (screenInfo == 0) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1599
	    goto out;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1600
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1601
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1602
	numberOfMonitors = __mkSmallInteger(numDisplays);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1603
	resultArray = __ARRAY_NEW_INT(numDisplays * 5);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1604
	cResultArray = __ArrayInstPtr(resultArray)->a_element;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1605
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1606
	for (i=0, ci=0; i < numDisplays; i++, ci+=5) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1607
	    cResultArray[ci] = __mkSmallInteger(screenInfo[i].screen_number);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1608
	    cResultArray[ci+1] = __mkSmallInteger(screenInfo[i].x_org);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1609
	    cResultArray[ci+2] = __mkSmallInteger(screenInfo[i].y_org);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1610
	    cResultArray[ci+3] = __mkSmallInteger(screenInfo[i].width);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1611
	    cResultArray[ci+4] = __mkSmallInteger(screenInfo[i].height);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1612
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1613
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1614
	XFree(screenInfo);
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1615
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1616
#endif
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1617
out:;
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1618
%}.
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1619
    numberOfMonitors isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1620
	"no xinerama - the display is the only monitor"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1621
	^ Array with:self bounds.
5885
a5af5e4ee7c8 changed:
Stefan Vogel <sv@exept.de>
parents: 5872
diff changeset
  1622
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1623
    rawMonitorBounds = resultArray ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1624
	^ monitorBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1625
    ].
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1626
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1627
    bounds := Array new:numberOfMonitors.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1628
    1 to:numberOfMonitors do:[:idx|
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1629
	|rect baseIdx|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1630
	baseIdx := (idx-1) * 5.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1631
	rect := Rectangle
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1632
		    left:(resultArray at:baseIdx+2)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1633
		    top:(resultArray at:baseIdx+3)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1634
		    width:(resultArray at:baseIdx+4)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1635
		    height:(resultArray at:baseIdx+5).
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  1636
	bounds at:idx put:rect.
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1637
    ].
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1638
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1639
    rawMonitorBounds := resultArray.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1640
    monitorBounds := bounds.
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1641
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1642
    "since the monitor configuration changed,
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1643
     we have to update the monitor settings"
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1644
5892
491bf533899e added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5891
diff changeset
  1645
    self initializeScreenBounds.
5891
a8f6f8d746ef changed: #monitorBounds
Stefan Vogel <sv@exept.de>
parents: 5890
diff changeset
  1646
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1647
    ^ bounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1648
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1649
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1650
     Display monitorBounds
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1651
    "
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  1652
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  1653
    "Modified: / 20-03-2018 / 12:20:18 / stefan"
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1654
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1655
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1656
monitorBoundsAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1657
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1658
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1659
    bounds := self monitorBounds.
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  1660
    ^ bounds
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1661
	detect:[:eachRectangle| eachRectangle containsPoint:aPoint]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1662
	ifNone:[super monitorBoundsAt:aPoint].
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1663
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1664
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1665
     Screen current monitorBoundsAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1666
     Screen current monitorBoundsAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1667
     Screen current monitorBoundsAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1668
     Screen current monitorBoundsAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1669
     Screen current monitorBoundsAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1670
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1671
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1672
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1673
numberOfMonitors
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1674
    ^ self monitorBounds size
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1675
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1676
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1677
	Display numberOfMonitors
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1678
    "
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
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1681
pointIsVisible:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1682
    "is the point visible?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1683
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1684
    |bounds|
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1685
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1686
    bounds := self monitorBounds.
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1687
    ^ bounds contains:[:eachRectangle| eachRectangle containsPoint:aPoint].
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1688
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1689
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1690
     Screen current pointIsVisible:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1691
     Screen current pointIsVisible:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1692
     Screen current pointIsVisible:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1693
     Screen current pointIsVisible:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1694
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1695
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1696
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1697
pointsAreOnSameMonitor:point1 and:point2
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1698
    "are the two points on the same (multi-screen) monitors?"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1699
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1700
    ^ (self monitorBoundsAt:point1) = (self monitorBoundsAt:point2)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1701
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1702
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1703
preferredIconSize
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1704
    "return the display's preferred size for icons.
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1705
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1706
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1707
    self serverVendor = 'Silicon Graphics' ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  1708
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1709
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1710
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1711
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1712
    "Created: / 10-06-1996 / 21:06:48 / cg"
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  1713
    "Modified (comment): / 01-09-2017 / 09:58:31 / cg"
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1714
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1715
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1716
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1717
    "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
  1718
     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
  1719
     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
  1720
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1721
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1722
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1723
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1724
smallestMonitorHeight
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1725
    "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
  1726
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1727
    |minH|
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
    minH := self usableHeight.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1730
    self monitorBounds do:[:eachBounds |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1731
	minH := minH min: eachBounds height.
5869
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
    ^ minH
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1734
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1735
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1736
	Display smallestMonitorHeight
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1737
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1738
!
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
  1739
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1740
supportedClipboards
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1741
    "answer a collection of symbols with the supported clipboards.
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1742
     X11 additionaly supports a buffer containing the currently selected text
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1743
     (in xterm) - the PRIMARY selection"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1744
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1745
    ^ #(clipboard selection)
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1746
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1747
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1748
supportedImageFormats
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1749
    "return an array with supported image formats;
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1750
     each array entry is an attribute dictionary, consisting of
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1751
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1752
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1753
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1754
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1755
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1756
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1757
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1758
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1759
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1760
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1761
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1762
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1763
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1764
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1765
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1766
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1767
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1768
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1769
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1770
    1 to:nFormats do:[:index |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1771
	|info bitsPerPixelInfo depthInfo paddingInfo i|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1772
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1773
	i := index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1774
%{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1775
	ScreenFormat *format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1776
	Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1777
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1778
#ifdef NO_PRIVATE_DISPLAY_ACCESS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1779
	depthInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1780
	bitsPerPixelInfo = __MKSMALLINT(1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1781
	paddingInfo = __MKSMALLINT(8);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1782
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1783
	format = DISPLAYACCESS(dpy)->pixmap_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1784
	format += (__intVal(i)-1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1785
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1786
	depthInfo = __MKSMALLINT(format->depth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1787
	paddingInfo = __MKSMALLINT(format->scanline_pad);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1788
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1789
%}.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1790
	info := IdentityDictionary new.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1791
	info at:#depth put:depthInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1792
	info at:#bitsPerPixel put:bitsPerPixelInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1793
	info at:#padding put:paddingInfo.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  1794
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1795
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1796
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1797
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1798
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1799
     Display supportedImageFormats
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1800
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1801
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1802
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1803
supportsAnyViewBackgroundPixmaps
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1804
    "return true, if the device allows pixmaps as viewBackground."
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1805
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1806
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1807
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1808
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1809
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1810
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1811
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1812
    "return true, if this workstation supports arbitrary shaped windows.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1813
     Both the server must support it (the shape-extension),
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1814
     and the feature must have been enabled in the smalltalk system,
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1815
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1816
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1817
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1818
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1819
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1820
     Display supportsArbitraryShapedViews
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1821
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1822
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1823
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1824
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1825
    "return true, if this device supports views as icons.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1826
     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
  1827
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1828
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1829
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1830
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1831
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1832
     Display supportsIconViews
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1833
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1834
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1835
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1836
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1837
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1838
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1839
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1840
    "return true, if the device allows the given form pixmap
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  1841
     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
  1842
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1843
7021
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1844
    ^ true
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1845
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1846
    "Created: / 4.5.1999 / 12:16:43 / cg"
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1847
!
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1848
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1849
supportsMaskedDrawingWithOffset:aForm
e5f10e127652 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7018
diff changeset
  1850
    "return true, if the device allows the given form pixmap
7022
f4531f98fd46 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 7021
diff changeset
  1851
     to be used as paint color with a mask offset.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1852
     True returned here - X has no trouble with any mask."
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1853
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1854
    "/ XQuartz seems to have a bug here...
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  1855
    ^ OperatingSystem isOSXlike not.
7756
e85e23f3b476 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
  1856
    "/ ^ true.
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1857
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1858
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1859
supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1860
    "return true, if the device allows reading the screen pixels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1861
     True returned here - X can do it"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1862
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1863
    "XQuartz seems to have a bug here...
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1864
     ...but only on XQuartz servers.
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1865
     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
  1866
     it does not return a valid server vendor string"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1867
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1868
	^ false
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1869
    ].
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1870
    ^ true
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1871
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1872
    "
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1873
     Display serverVendor
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1874
     Display supportsScreenReading
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1875
    "
7886
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1876
b5cd58bc7eb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7864
diff changeset
  1877
    "Modified (comment): / 13-02-2017 / 20:35:34 / cg"
7229
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1878
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1879
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1880
supportsUTF8WindowLabels
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1881
    "answer true, if window labels are to be utf-8 encoded"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1882
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1883
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1884
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1885
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1886
supportsVariableHeightFonts
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1887
    "are fonts with variable height supported?"
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1888
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1889
    ^ false
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1890
!
30da116b864d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 7147
diff changeset
  1891
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1892
supportsViewBackgroundPixmap:aForm
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1893
    "return true, if the device allows the given pixmap as viewBackground.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1894
     True returned here - X supports any size.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1895
     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
  1896
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1897
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1898
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1899
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1900
    "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
  1901
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1902
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1903
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1904
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1905
     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
  1906
     are faster, if they are."
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1907
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1908
    ^ true
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1909
!
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1910
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1911
supportsXCursor
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1912
    "return true, if the XCursor extension (deep cursors ) are supported
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1913
     on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1914
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1915
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1916
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1917
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1918
     ^ self class hasXCursorLibrary
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1919
	and:[self hasCursorExtension]
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1920
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1921
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1922
     Display supportsXCursor
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1923
     Display hasCursorExtension
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1924
     Display class hasXCursorLibrary
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1925
    "
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1926
!
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1927
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1928
supportsXftFonts
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1929
    "return true, if XftFonts (nice looking truetype fonts)
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1930
     are supported on this display.
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1931
     Both Smalltalk has to be compiled to support it (as client),
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1932
     and the display we are connected to must support it,
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1933
     to return true here."
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1934
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  1935
     ^ XftFontDescription notNil and:[hasXftLibrary].
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1936
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1937
    "
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1938
     Display supportsXftFonts
6975
da4fb0542fca #FEATURE
Claus Gittinger <cg@exept.de>
parents: 6958
diff changeset
  1939
     Display hasRenderExtension
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  1940
     Display class hasXftLibrary
6538
04f9cecef7c3 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6522
diff changeset
  1941
    "
6522
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1942
!
ced38b522493 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  1943
7699
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1944
supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1945
    "return true, if XftFonts (nice looking truetype fonts)
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1946
     are supported when drawing into bitmaps on this display.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1947
     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
  1948
     rendering into bitmaps"
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1949
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1950
     ^ false.
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1951
     "/ ^ self supportsXftFonts
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1952
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1953
    "
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1954
     Display supportsXftFontsInBitmaps
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1955
     Display hasRenderExtension
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1956
     Display class hasXftLibrary
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1957
    "
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1958
!
8c953a0bca19 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7696
diff changeset
  1959
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1960
suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1961
    "return true, if this device wants to suppress shadow views
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1962
     (i.e. shadows under popups and modalBoxes).
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1963
     Some (slow) devices may want to return true here.
7352
6c47c5980dff #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7351
diff changeset
  1964
     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
  1965
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1966
    OperatingSystem isOSXlike ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  1967
	^ true
6997
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1968
    ].
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1969
    ^ super suppressShadowViews
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1970
!
2144afaf1cfc #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6975
diff changeset
  1971
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1972
usableHeightAt:aPoint
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1973
    "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
  1974
     Normally, the same as height, but may be smaller, in
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1975
     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
  1976
     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
  1977
     which display is at the given x-position"
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1978
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1979
    |h|
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1980
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1981
    h := (self monitorBoundsAt:aPoint) height.
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1982
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1983
	"/ take away some space for the dock at the bottom.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  1984
	^ h - 50
6026
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1985
    ].
688f086bfe9e class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6010
diff changeset
  1986
    ^ h
5870
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1987
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1988
    "
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1989
     Screen current usableHeightAt:(0@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1990
     Screen current usableHeightAt:(1500@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1991
     Screen current usableHeightAt:(3000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1992
     Screen current usableHeightAt:(9000@0)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1993
     Screen current usableHeightAt:(Display pointFromUser)
3c43dc838aaa added:5 methods
Stefan Vogel <sv@exept.de>
parents: 5869
diff changeset
  1994
    "
7965
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1995
0ac51341dedf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7959
diff changeset
  1996
    "Modified (format): / 05-03-2017 / 11:25:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1997
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1998
48194c26a46c Initial revision
claus
parents:
diff changeset
  1999
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2000
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2001
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  2002
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  2003
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  2004
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2005
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2006
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2007
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2008
    bitmapId isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2009
	self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2010
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2011
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2012
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2013
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2014
createBitmapFromFile:aString for:aForm
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2015
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2016
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2017
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2018
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2019
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2020
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2021
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2022
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2023
     && __isStringLike(aString)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2024
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2025
	char *filename;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2026
	int status;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2027
	Pixmap newBitmap;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2028
	unsigned b_width, b_height;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2029
	int b_x_hot, b_y_hot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2030
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2031
	filename = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2032
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2033
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2034
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2035
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2036
				 filename, &b_width, &b_height, &newBitmap,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2037
				 &b_x_hot, &b_y_hot);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2038
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2039
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2040
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2041
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2042
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2043
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2044
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2045
	    w = __MKSMALLINT(b_width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2046
	    h = __MKSMALLINT(b_height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2047
	    id = __MKEXTERNALADDRESS(newBitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2048
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2049
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2050
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2051
    id notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2052
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2053
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2054
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2055
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2056
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2057
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2058
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2059
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2060
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2061
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2062
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2063
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2064
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2065
    Pixmap newBitmap;
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
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2068
	Display *dpy = myDpy;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2069
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2070
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2071
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2072
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2073
				       __intVal(w), __intVal(h), 1);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2074
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2075
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2076
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2077
	    __cnt_bitmap++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2078
#endif
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2079
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2080
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2081
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2082
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2083
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2084
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2085
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2086
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2087
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  2088
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  2089
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2090
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2091
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2092
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2093
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2094
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2095
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2096
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2097
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2098
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2099
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2100
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2101
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2102
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2103
				       __intVal(w), __intVal(h), __intVal(d));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2104
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2105
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2106
	if (newBitmap)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2107
	    __cnt_bitmap++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2108
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2109
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2110
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2111
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  2112
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2113
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2114
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2115
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2116
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  2117
createWindowFor:aView type:typeSymbol
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2118
		 origin:origin
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2119
		 extent:extent
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2120
		 minExtent:minExt
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2121
		 maxExtent:maxExt
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2122
		 borderWidth:bWidth
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2123
		 subViewOf:wsuperView
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2124
		 style:wStyle
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2125
		 inputOnly:winputOnly
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2126
		 label:wlabel
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2127
		 owner:wowner
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2128
		 icon:wicon iconMask:wiconMask
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2129
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2130
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2131
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2132
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2133
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2134
     bColorId wsuperViewId windowId isTopWindow
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2135
     weventMask bitGravity viewGravity vBgColor
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  2136
     vBgForm deepForm preferredVisual preferredDepth
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2137
     wiconId wiconMaskId wiconViewId windowGroupWindowId|
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2138
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2139
    self isOpen ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2140
	self primitiveFailedOrClosedConnection.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2141
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2142
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2143
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2144
    origin notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2145
	xpos := origin x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2146
	ypos := origin y.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2147
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2148
    extent notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2149
	wwidth := extent x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2150
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2151
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2152
    minExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2153
	minWidth := minExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2154
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2155
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2156
    maxExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2157
	maxWidth := maxExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2158
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2159
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2160
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2161
    wsuperView notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2162
	wsuperViewId := wsuperView drawableId.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2163
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2164
	isTopWindow := true.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2165
	aView class ~~ WindowGroupWindow ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2166
	    windowGroupWindow isNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2167
		self getWindowGroupWindow.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2168
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2169
	    windowGroupWindowId := windowGroupWindow drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2170
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2171
	wicon notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2172
	    wiconId := wicon drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2173
	    wiconMask notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2174
		wiconMaskId := wiconMask drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2175
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2176
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2177
	wiconView notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2178
	    wiconViewId := wiconView drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2179
	].
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2180
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2181
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2182
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2183
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2184
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2185
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2186
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2187
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  2188
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2189
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2190
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2191
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2192
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2193
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2194
    XSizeHints sizehints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2195
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2196
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2197
    XFontStruct *f;
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2198
    Pixmap backPixmap = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2199
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2200
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2201
    Atom WmQuitAppAtom, MotifWMHintsAtom;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  2202
    Atom STXDeviceAtom, UUIDAtom;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2203
    Atom atoms[3];
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2204
    int atomCount = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2205
48194c26a46c Initial revision
claus
parents:
diff changeset
  2206
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2207
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2208
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2209
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2210
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2211
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2212
    if (__bothSmallInteger(wwidth, wheight)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2213
	sizehints.flags |= PSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2214
	sizehints.width = __intVal(wwidth);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2215
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2216
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2217
    if (__bothSmallInteger(xpos, ypos)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2218
	sizehints.flags |= PPosition;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2219
	sizehints.x = __intVal(xpos);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2220
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2221
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2222
    if (__bothSmallInteger(minWidth, minHeight)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2223
	sizehints.flags |= PMinSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2224
	sizehints.min_width = __intVal(minWidth);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2225
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2226
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2227
    if (__bothSmallInteger(maxWidth, maxHeight)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2228
	sizehints.flags |= PMaxSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2229
	sizehints.max_width = __intVal(maxWidth);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2230
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2231
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2232
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  2233
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2234
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2235
    if (__isSmallInteger(bWidth)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2236
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2237
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2238
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2239
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2240
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2241
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2242
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2243
    if (__isExternalAddress(wsuperViewId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2244
	parentWindow = __WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2245
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2246
	parentWindow = RootWindow(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2247
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2248
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  2249
    if (wStyle == @symbol(popUp))
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2250
	xswa.override_redirect = 1;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2251
    else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2252
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2253
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2254
    if (winputOnly == true)
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2255
	ioClass = InputOnly;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2256
    else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2257
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2258
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2259
    if (__isSmallInteger(weventMask)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2260
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2261
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2262
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2263
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2264
48194c26a46c Initial revision
claus
parents:
diff changeset
  2265
    if (ioClass == InputOnly) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2266
	bw = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2267
	depth = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2268
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2269
    } else {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2270
	depth = DefaultDepth(dpy,screen);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2271
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2272
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2273
	if (backPixmap != (Pixmap)0) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2274
	    xswa.background_pixmap = backPixmap;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2275
	    flags |= CWBackPixmap;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2276
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2277
	    xswa.background_pixel = bg;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2278
	    flags |= CWBackPixel;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2279
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2280
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2281
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2282
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2283
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2284
    if (__isSmallInteger(preferredDepth)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2285
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  2286
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2287
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2288
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  2289
    if (preferredVisual != nil) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2290
	XVisualInfo vi;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2291
	int cls;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2292
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2293
	if (preferredVisual == @symbol(StaticGray))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2294
	    cls = StaticGray;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2295
	else if (preferredVisual == @symbol(GrayScale))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2296
	    cls = GrayScale;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2297
	else if (preferredVisual == @symbol(StaticColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2298
	    cls = StaticColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2299
	else if (preferredVisual == @symbol(PseudoColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2300
	    cls = PseudoColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2301
	else if (preferredVisual == @symbol(TrueColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2302
	    cls = TrueColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2303
	else if (preferredVisual == @symbol(DirectColor))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2304
	    cls = DirectColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2305
	else
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2306
	    cls = PseudoColor;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2307
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2308
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2309
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2310
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  2311
/*
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2312
	    console_fprintf(stderr, "visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  2313
*/
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2314
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2315
	LEAVE_XLIB();
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2316
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2317
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2318
    ENTER_XLIB2();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2319
    newWindow = XCreateWindow(dpy, parentWindow,
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2320
			   sizehints.x, sizehints.y,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2321
			   sizehints.width, sizehints.height,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2322
			   bw, depth, ioClass, &visual,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2323
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2324
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2325
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2326
48194c26a46c Initial revision
claus
parents:
diff changeset
  2327
    if (! newWindow) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2328
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2329
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2330
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2331
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2332
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2333
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2334
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2335
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  2336
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  2337
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  2338
     */
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2339
    if (isTopWindow == true) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2340
	XWMHints wmhints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2341
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2342
	wmhints.flags = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2343
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2344
	if (__isExternalAddress(wiconId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2345
	    wmhints.icon_pixmap = __PixmapVal(wiconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2346
	    wmhints.flags = IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2347
	    if (__isExternalAddress(wiconMaskId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2348
		wmhints.icon_mask = __PixmapVal(wiconMaskId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2349
		wmhints.flags |= IconMaskHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2350
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2351
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2352
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2353
	if (__isExternalAddress(windowGroupWindowId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2354
	    wmhints.window_group = __WindowVal(windowGroupWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2355
	    wmhints.flags |= WindowGroupHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2356
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2357
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2358
	if (__isExternalAddress(wiconViewId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2359
	    wmhints.flags |= IconWindowHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2360
	    wmhints.icon_window = __WindowVal(wiconViewId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2361
	};
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2362
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2363
/*
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2364
	wmhints.flags |= InputHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2365
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2366
*/
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2367
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2368
	XSetWMHints(dpy, newWindow, &wmhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2369
	XSetWMNormalHints(dpy, newWindow, &sizehints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2370
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2371
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2372
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2373
	 * get atoms first (if not already known)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2374
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2375
	if (__INST(protocolsAtom) == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2376
	    ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2377
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2378
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2379
#ifdef USE_SAVEYOURSELF_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2380
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2381
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2382
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2383
#ifdef USE_QUIT_APP_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2384
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2385
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2386
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2387
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2388
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2389
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2390
	    UUIDAtom = XInternAtom(dpy, "UUID", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2391
	    __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2392
	    STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2393
	    __INST(stxDeviceAtom) = __MKATOMOBJ(STXDeviceAtom);
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
	    LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2396
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2397
#ifdef USE_QUIT_APP_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2398
	    WmQuitAppAtom = __AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2399
#else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2400
	    WmQuitAppAtom = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2401
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2402
	    WmProtocolsAtom = __AtomVal(__INST(protocolsAtom));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2403
	    WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2404
#ifdef USE_SAVEYOURSELF_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2405
	    WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2406
#else
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2407
	    WmSaveYourselfAtom = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2408
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2409
	    UUIDAtom = __AtomVal(__INST(uuidAtom));;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2410
	    STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2411
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2412
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2413
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2414
	 * 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
  2415
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2416
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2417
#ifdef USE_SAVEYOURSELF_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2418
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2419
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  2420
#ifdef USE_QUIT_APP_ATOM
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2421
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2422
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2423
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2424
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2425
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2426
	LEAVE_XLIB();
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
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2429
	 * an optional unique id (to mark stx-windows)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2430
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2431
	if (__isBytes(__INST(uniqueDeviceID))) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2432
	    int numUUIDBytes = __byteArraySize(__INST(uniqueDeviceID));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2433
	    unsigned char uuidBytes[32];
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2434
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2435
	    if (numUUIDBytes <= sizeof(uuidBytes)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2436
		Atom uuidAtom;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2437
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2438
		bcopy(__byteArrayVal(__INST(uniqueDeviceID)), uuidBytes, numUUIDBytes);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2439
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2440
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2441
		XChangeProperty (dpy, newWindow, STXDeviceAtom, UUIDAtom, 8, PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2442
				 uuidBytes, numUUIDBytes );
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2443
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2444
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2445
	}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  2446
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2447
#ifdef SUPPORT_MOTIF_WM_HINTS
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2448
	/*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2449
	 * less decoration
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2450
	 */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2451
	if ((wStyle == @symbol(undecorated))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2452
	 || (wStyle == @symbol(dialog2))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2453
	 || (wStyle == @symbol(notitle))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2454
	) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2455
	    if (__INST(motifWMHintsAtom) == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2456
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2457
		MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2458
		__INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2459
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2460
	    } else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2461
		MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2462
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2463
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
		struct hints {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2466
		    unsigned long flags;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2467
		    unsigned long functions;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2468
		    unsigned long decorations;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2469
		    long input_mode;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2470
		    unsigned long status;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2471
		} mvm_hints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2472
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2473
		if (wStyle == @symbol(undecorated)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2474
		    mvm_hints.decorations = MWM_DECOR_NONE;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2475
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2476
		if (wStyle == @symbol(dialog2)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2477
		    mvm_hints.decorations = MWM_DECOR_BORDER
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2478
					    | MWM_DECOR_RESIZEH
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2479
					    | MWM_DECOR_TITLE
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2480
					    /* | MWM_DECOR_MENU */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2481
					    /* | MWM_DECOR_MINIMIZE */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2482
					    /* | MWM_DECOR_MAXIMIZE */
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
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2485
		if (wStyle == @symbol(notitle)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2486
		    mvm_hints.decorations = MWM_DECOR_BORDER
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2487
					    /* | MWM_DECOR_RESIZEH  */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2488
					    /* | MWM_DECOR_TITLE    */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2489
					    /* | MWM_DECOR_MENU     */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2490
					    /* | MWM_DECOR_MINIMIZE */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2491
					    /* | MWM_DECOR_MAXIMIZE */
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
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2494
		mvm_hints.flags =  MWM_HINTS_DECORATIONS;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2495
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2496
		XChangeProperty (dpy, newWindow, MotifWMHintsAtom,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2497
				     MotifWMHintsAtom, 32, PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2498
				     (unsigned char*)&mvm_hints, 5 );
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2499
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2500
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2501
	}
4090
b1dc981c8b10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4086
diff changeset
  2502
#endif /* SUPPORT_MOTIF_WM_HINTS */
4082
cb6eb58e8311 set MWM-Decoration-Hints
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  2503
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2504
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2505
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2506
%}.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2507
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2508
"/    (wStyle ~= nil and:[wStyle ~= #normal]) ifTrue:[
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2509
"/        self setWindowType:wStyle in:windowId.
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
  2510
"/    ].
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2511
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2512
    (wsuperView isNil "this is a topwindow"
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2513
     and:[wlabel notEmptyOrNil]) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2514
	self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2515
	    setIconName:wlabel in:windowId;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2516
	    setWindowName:wlabel in:windowId.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2517
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  2518
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
  2519
    self addKnownView:aView withId:windowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2520
    ^ windowId
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2521
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  2522
    "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
  2523
    "Modified: / 26-04-2018 / 11:02:09 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2524
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2525
48194c26a46c Initial revision
claus
parents:
diff changeset
  2526
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2527
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2528
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2529
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2530
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2531
     * 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
  2532
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2533
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2534
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2535
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2536
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2537
    if (__isExternalAddress(aGCId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2538
	GC gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2539
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2540
	if (gc) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2541
	    __ExternalAddressInstPtr(aGCId)->e_address = NULL;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2542
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2543
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2544
	    XFreeGC(myDpy, gc);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2545
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2546
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2547
	    __cnt_gc--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2548
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2549
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2550
	    console_fprintf(stderr, "XWorkstation [warning]: trying to destroy GC twice\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2551
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2552
	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
  2553
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2554
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2555
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2556
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2557
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2558
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2559
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2560
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2561
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2562
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2563
     * 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
  2564
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2565
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2566
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2567
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2568
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2569
    if (__isExternalAddress(aDrawableId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2570
	Pixmap pix = __PixmapVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2571
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2572
	if (pix) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2573
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2574
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2575
	    XFreePixmap(myDpy, pix);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2576
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2577
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2578
	    __cnt_bitmap--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2579
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2580
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2581
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2582
	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
  2583
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2584
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  2585
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2586
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2587
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2588
destroyView:aViewOrNil withId:aWindowId
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2589
    XftFontDescription notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  2590
	XftFontDescription aboutToDestroyViewWithDevice:self id:aWindowId.
6958
Stefan Vogel <sv@exept.de>
parents: 6904
diff changeset
  2591
    ].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2592
    self primDestroyViewWithId:aWindowId.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2593
    self removeKnownView:aViewOrNil withId:aWindowId.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2594
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2595
48194c26a46c Initial revision
claus
parents:
diff changeset
  2596
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  2597
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2598
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
  2599
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2600
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2601
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2602
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2603
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2604
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2605
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2606
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2607
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2608
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2609
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2610
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2611
	dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2612
				       __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2613
				       0, height, 0, colormap, NULL, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2614
				       XDPSDefaultTextBackstop,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2615
				       XDPSDefaultErrorProc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2616
				       NULL);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2617
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2618
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2619
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2620
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2621
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2622
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2623
    self primitiveFailedOrClosedConnection.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2624
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2625
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2626
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2627
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  2628
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2629
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2630
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2631
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2632
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2633
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2634
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2635
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2636
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2637
	gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2638
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2639
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2640
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2641
	if (gc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2642
	    __cnt_gc++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2643
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2644
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2645
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2646
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2647
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2648
    self primitiveFailedOrClosedConnection.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2649
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2650
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2651
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2652
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2653
    "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
  2654
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2655
    ^ self gcFor:aDrawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2656
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2657
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2658
primCreateBitmapFromArray:anArray width:w height:h
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2659
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2660
154
claus
parents: 153
diff changeset
  2661
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  2662
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2663
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2664
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2665
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2666
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2667
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2668
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2669
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2670
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2671
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2672
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2673
    static char reverseBitTable[256];
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  2674
    static int firstCall = 1;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2675
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2676
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2677
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2678
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2679
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2680
    if (! ISCONNECTED) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2681
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2682
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2683
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2684
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2685
    if (firstCall) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2686
	for (index=0; index < 256; index++) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2687
	    int t = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2688
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2689
	    if (index & 128) t |=   1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2690
	    if (index &  64) t |=   2;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2691
	    if (index &  32) t |=   4;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2692
	    if (index &  16) t |=   8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2693
	    if (index &   8) t |=  16;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2694
	    if (index &   4) t |=  32;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2695
	    if (index &   2) t |=  64;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2696
	    if (index &   1) t |= 128;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2697
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2698
	    reverseBitTable[index] = t;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2699
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2700
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2701
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2702
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2703
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2704
	newBitmap = (Pixmap)0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2705
	b_width = __intVal(w);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2706
	b_height = __intVal(h);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2707
	bytesPerRow = (b_width + 7) / 8;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2708
	nBytes = b_height * bytesPerRow;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2709
	if (nBytes < sizeof(fastBits)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2710
	    cp = b_bits = fastBits;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2711
	    allocatedBits = 0;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2712
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2713
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2714
	    if (! cp) goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2715
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2716
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2717
	if (__isArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2718
	    index = 1;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2719
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2720
	    for (row = b_height; row; row--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2721
		for (col = bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2722
		    num = *op++;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2723
		    if (__isSmallInteger(num)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2724
			bits = __intVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2725
		    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2726
			bits = __longIntVal(num);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2727
			if (bits == 0) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2728
			    goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2729
			}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2730
		    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2731
		    *cp++ = reverseBitTable[bits & 0xFF];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2732
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2733
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2734
	} else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2735
	    if (__isByteArrayLike(anArray)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2736
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2737
		for (col = b_height*bytesPerRow; col; col--) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2738
		    *cp++ = reverseBitTable[*pBits++];
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2739
		}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2740
	    } else {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2741
		goto fail;
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2742
	    }
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2743
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2744
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2745
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2746
	ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2747
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2748
					       (char *)b_bits,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2749
					       b_width, b_height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2750
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2751
#ifdef COUNT_RESOURCES
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2752
	if (newBitmap)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2753
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2754
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2755
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2756
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2757
fail: ;
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2758
	if (allocatedBits)
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2759
	    free(allocatedBits);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  2760
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2761
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2762
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2763
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2764
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2765
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2766
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
  2767
    "for rel5 only"
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2768
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2769
    ^ self primitiveFailedOrClosedConnection
3228
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2770
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2771
!
c4d942d8c69a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3227
diff changeset
  2772
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  2773
primDestroyViewWithId:aWindowId
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2774
    <context: #return>
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2775
%{
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2776
    if (! ISCONNECTED) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2777
	RETURN ( self );
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2778
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2779
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2780
    if (__isExternalAddress(aWindowId)) {
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2781
	Window win = __WindowVal(aWindowId);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2782
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2783
	if (win) {
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2784
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2785
	    ENTER_XLIB();
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2786
	    XDestroyWindow(myDpy, win);
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2787
	    LEAVE_XLIB();
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2788
#ifdef COUNT_RESOURCES
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2789
	    __cnt_view--;
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2790
#endif
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2791
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  2792
	}
3250
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2793
    }
250ee58a0634 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3245
diff changeset
  2794
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2795
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2796
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2797
!XWorkstation methodsFor:'clipboard'!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2798
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2799
getPrimaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2800
    "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
  2801
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2802
    ^ primaryBuffer
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2803
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2804
    "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
  2805
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2806
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2807
primaryBufferAsString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2808
    "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
  2809
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
  2810
    ^ self class bufferAsString:self getPrimaryBuffer.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2811
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2812
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2813
setPrimaryBuffer:aString
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2814
    "Sets the contents of PRIMARY selection."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2815
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2816
    primaryBuffer := aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2817
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2818
    "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
  2819
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2820
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2821
setPrimaryText:aString ownerView:aView
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2822
    "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
  2823
     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
  2824
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2825
    |s viewID|
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2826
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2827
    self setPrimaryBuffer:aString.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2828
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2829
    s := aString ? ''.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2830
    s isString ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2831
	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
  2832
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2833
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  2834
    viewID := aView drawableId.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2835
    viewID notNil ifTrue:[ "/ if the view is not already closed
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2836
	"/ for now - should add support to pass emphasis information too
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2837
	s := s string.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  2838
	self setPrimaryText:s owner:viewID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2839
    ]
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2840
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2841
    "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
  2842
    "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
  2843
! !
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  2844
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2845
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2846
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2847
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2848
    "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
  2849
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2850
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2851
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2852
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2853
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2854
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2855
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2856
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2857
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2858
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2859
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2860
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2861
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2862
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2863
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2864
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2865
				   &dummy, 0, &color.pixel, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2866
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2867
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2868
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2869
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2870
	    __cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2871
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2872
	    RETURN ( __MKSMALLINT(color.pixel) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2873
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2874
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2875
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2876
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2877
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2878
48194c26a46c Initial revision
claus
parents:
diff changeset
  2879
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
  2880
    "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
  2881
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2882
     and the returned colorID is formed by simply packing the RGB values.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2883
     Don't use this method, colornames are mostly X specific."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2884
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2885
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2886
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2887
48194c26a46c Initial revision
claus
parents:
diff changeset
  2888
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2889
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2890
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2891
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2892
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2893
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2894
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  2895
     && __isStringLike(aString)) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2896
	Display *dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2897
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2898
	colorname = (char *) __stringVal(aString);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2899
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2900
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2901
	ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2902
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2903
	LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2904
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2905
#ifdef QUICK_TRUE_COLORS
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2906
	    if (__INST(visualType) == @symbol(TrueColor)) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2907
		id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2908
		id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2909
		id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2910
		RETURN ( __MKSMALLINT(id) );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2911
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2912
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2913
	    ENTER_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2914
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2915
	    LEAVE_XLIB();
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2916
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2917
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2918
	if (! ok) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2919
	    RETURN ( nil );
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2920
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2921
#ifdef COUNT_RESOURCES
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2922
	__cnt_color++;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2923
#endif
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2924
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2925
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2926
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2927
    ^ 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
  2928
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2929
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2930
colorScaledRed:r scaledGreen:g scaledBlue:b
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2931
    "allocate a color with rgb values (0..16rFFFF)
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2932
     - return the color index (i.e. colorID).
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2933
     On trueColor displays, nothing is actually allocated,
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  2934
     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
  2935
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2936
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2937
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2938
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2939
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2940
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2941
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2942
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2943
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2944
    if (__bothSmallInteger(r, g)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2945
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2946
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2947
	ecolor.red = __intVal(r);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2948
	ecolor.green= __intVal(g);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2949
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2950
#ifdef QUICK_TRUE_COLORS
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2951
	if (__INST(visualType) == @symbol(TrueColor)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2952
	    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
  2953
	    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
  2954
	    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
  2955
	    RETURN ( __MKSMALLINT(id) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2956
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2957
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2958
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2959
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2960
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2961
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2962
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2963
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2964
	if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2965
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2966
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2967
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2968
	__cnt_color++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2969
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  2970
	RETURN ( __MKSMALLINT(ecolor.pixel) );
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2971
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2972
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2973
    ^ super colorScaledRed:r scaledGreen:g scaledBlue:b
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2974
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2975
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2976
deviceColorValueToPercent:aDeviceValue
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2977
    "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
  2978
     x-component value (0..100)"
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
    ^ (100.0 * aDeviceValue / 16rFFFF)
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2981
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2982
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2983
     Display deviceColorValueToPercent:0
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  2984
     Display deviceColorValueToPercent:16r8000
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2985
     Display deviceColorValueToPercent:16rFFFF
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  2986
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2987
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2988
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2989
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2990
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2991
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2992
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  2993
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2994
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2995
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2996
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2997
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2998
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2999
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3000
    if (__INST(visualType) == @symbol(TrueColor)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3001
	/* no need to do anything on TrueColor displays ... */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3002
	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
  3003
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3004
#endif
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3005
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3006
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3007
     * 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
  3008
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3009
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3010
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3011
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3012
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3013
    if (__isSmallInteger(colorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3014
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3015
	color = (long) __intVal(colorIndex);
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3018
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3019
	LEAVE_XLIB();
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3024
	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
  3025
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3026
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3027
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3028
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3029
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3030
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
  3031
    "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
  3032
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3033
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3034
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3035
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3036
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3037
    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
  3038
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3039
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3040
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3041
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3042
     && __isSmallInteger(index)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3043
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3044
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3045
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3046
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3047
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3048
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3049
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3050
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3051
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3052
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3053
	 * 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
  3054
	 * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3055
	 * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3056
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3057
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3058
	bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3059
	scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3060
	shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3061
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3062
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3063
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3064
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3065
	RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3066
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3067
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3068
    ^ super getScaledRGBFrom:index
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3069
!
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3070
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3071
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
  3072
    "get rgb components (0..16rFFFF) of color named colorName,
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3073
     and return a 3-element array containing them"
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3074
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3075
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3076
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3077
    XColor color;
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3078
    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
  3079
    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
  3080
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3081
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3082
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  3083
     && __isStringLike(colorName)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3084
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3085
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3086
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3087
	if (XParseColor(dpy, DefaultColormap(dpy, screen),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3088
			     (char *) __stringVal(colorName), &color)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3089
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3090
	     * 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
  3091
	     * colors correctly if lesser than 16bits are valid in a color,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3092
	     * (for example, color white on a 4bitsPerRGB server will Return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3093
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3094
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3095
	    bits = __intVal(__INST(bitsPerRGB));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3096
	    scale = (1<<bits) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3097
	    shift = 16 - bits;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3098
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3099
	    /* do assignment to doubles (no cast) - avoid alignment problems in HPPA */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3100
	    dr = color.red>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3101
	    dg = color.green>>shift;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3102
	    db = color.blue>>shift;
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
	    sr = (dr / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3105
	    sg = (dg / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3106
	    sb = (db / scale) * 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3107
	    RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb)));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3108
	}
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3109
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3110
    }
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3111
%}.
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3112
    ^ super getScaledRGBFromName:colorName
5034
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3113
c2e7d8a07da8 Some machines (hppa) have alignment problems, when casting something unaligned
Stefan Vogel <sv@exept.de>
parents: 5033
diff changeset
  3114
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3115
	Screen current getScaledRGBFromName:'red'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3116
	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
  3117
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3118
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3119
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3120
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3121
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3122
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3123
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3124
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3125
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3126
3814
0d856538e64f Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents: 3806
diff changeset
  3127
    aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3128
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3129
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3130
    [aStream atEnd] whileFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3131
	line := aStream nextLine.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3132
	line notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3133
	    "skip the r/g/b numbers"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3134
	    index := 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3135
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3136
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3137
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3138
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3139
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3140
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3141
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3142
	    colorName := line copyFrom:index.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3143
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3144
		list add:colorName
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3145
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3146
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3147
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3148
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3149
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3150
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3151
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3152
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3153
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3154
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  3155
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3156
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3157
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3158
percentToDeviceColorValue:aPercentage
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3159
    "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
  3160
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3161
3220
e3e2f81a99df reorganized color protocl
Claus Gittinger <cg@exept.de>
parents: 3216
diff changeset
  3162
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3163
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3164
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3165
    if (__isSmallInteger(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3166
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3167
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3168
    if (__isFloat(aPercentage)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3169
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3170
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3171
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3172
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3173
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3174
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3175
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
  3176
    "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
  3177
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3178
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3179
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3180
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3181
48194c26a46c Initial revision
claus
parents:
diff changeset
  3182
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3183
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3184
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3185
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3186
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3187
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3188
    if (__isSmallInteger(sred))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3189
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3190
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3191
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3192
    if (__isSmallInteger(sgreen))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3193
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3194
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3195
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  3196
    if (__isSmallInteger(sblue))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3197
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3198
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3199
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3200
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3201
     && __isSmallInteger(index) && ok) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3202
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3203
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3204
	color.pixel = __intVal(index);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3205
	color.red = r;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3206
	color.green = g;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3207
	color.blue = b;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3208
	color.flags = DoRed | DoGreen | DoBlue;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3209
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3210
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3211
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3212
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3213
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3214
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3215
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3216
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3217
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3218
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3219
! !
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
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3222
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3223
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3224
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3225
     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
  3226
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3227
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3228
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3229
    "/ 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
  3230
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3231
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3232
	#upLeftArrow            "/ XC_top_left_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3233
	#upRightHand            "/ XC_hand1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3234
	#upDownArrow            "/ XC_sb_v_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3235
	#leftRightArrow         "/ XC_sb_h_double_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3236
	#upLimitArrow           "/ XC_top_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3237
	#downLimitArrow         "/ XC_bottom_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3238
	#leftLimitArrow         "/ XC_left_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3239
	#rightLimitArrow        "/ XC_right_side
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3240
	#text                   "/ XC_xterm
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3241
	#upRightArrow           "/ XC_draft_large
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3242
	#leftHand               "/ XC_hand2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3243
	#questionMark           "/ XC_question_arrow
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3244
	#cross                  "/ XC_X_cursor
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3245
	#wait                   "/ XC_watch
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3246
	#crossHair              "/ XC_tcross
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3247
	#origin                 "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3248
	#topLeft                "/ XC_ul_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3249
	#corner                 "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3250
	#bottomRight            "/ XC_lr_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3251
	#topRight               "/ XC_ur_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3252
	#bottomLeft             "/ XC_ll_angle
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3253
	#square                 "/ XC_dotbox
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3254
	#fourWay                "/ XC_fleur
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3255
	#crossCursor            "/ XC_X_cursor
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3256
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3257
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3258
    "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
  3259
    "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
  3260
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3261
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3262
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3263
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3264
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3265
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3266
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3267
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3268
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3269
    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
  3270
    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
  3271
    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
  3272
    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
  3273
    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
  3274
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3275
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3276
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3277
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3278
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3279
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3280
     && __bothSmallInteger(fgG, fgB)
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3281
     && __bothSmallInteger(bgR, bgG)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3282
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3283
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3284
	fgcolor.red = __intVal(fgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3285
	fgcolor.green= __intVal(fgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3286
	fgcolor.blue = __intVal(fgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3287
	bgcolor.red = __intVal(bgR);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3288
	bgcolor.green= __intVal(bgG);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3289
	bgcolor.blue = __intVal(bgB);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3290
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3291
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3292
	XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3293
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3294
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3295
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  3296
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3297
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3298
    self primitiveFailedOrClosedConnection
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3299
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3300
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3301
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3302
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3303
     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
  3304
     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
  3305
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3306
    |shapeNumber|
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3307
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3308
    shapeNumber := self shapeNumberFromSymbol:aShape.
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3309
    shapeNumber isNil ifTrue:[^ nil].
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3310
    ^ self primCreateCursorShapeNumber:shapeNumber
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3311
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3312
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3313
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
  3314
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3315
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3316
    ^ self
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3317
	primCreateCursorSourceFormId:sourceForm drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3318
	maskFormId:maskForm drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3319
	hotX:hx hotY:hy
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3320
	width:w height:h
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3321
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3322
    "Modified: / 26-04-2018 / 11:02:52 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3323
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3324
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3325
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3326
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3327
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3328
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3329
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3330
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3331
     * 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
  3332
     */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3333
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3334
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3335
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3336
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  3337
    if (__isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3338
	Cursor curs = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3339
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3340
	if (curs) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3341
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3342
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3343
	    XFreeCursor(myDpy, curs);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3344
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  3345
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3346
	    __cnt_cursor--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3347
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3348
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3349
	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
  3350
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3351
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  3352
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3353
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3354
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3355
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3356
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3357
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3358
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3359
primCreateCursorShapeNumber:aShapeNumber
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3360
    "create a cursor given a shape-number."
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3361
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3362
    <context: #return>
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3363
%{
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3364
    Cursor newCursor;
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3365
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3366
    if (ISCONNECTED
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3367
     && __isSmallInteger(aShapeNumber)) {
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3368
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3369
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3370
	newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3371
	LEAVE_XLIB();
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3372
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3373
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3374
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3375
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3376
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3377
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3378
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3379
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3380
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3381
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3382
    self primitiveFailedOrClosedConnection.
3226
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3383
    ^ nil
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3384
!
e01fe43e24f0 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3225
diff changeset
  3385
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3386
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3387
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3388
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3389
    <context: #return>
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3390
%{
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3391
    Cursor newCursor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3392
    XColor fgColor, bgColor;
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3393
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3394
    if (ISCONNECTED
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3395
     && __isExternalAddress(sourceId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3396
     && __isExternalAddress(maskId)
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3397
     && __bothSmallInteger(hx, hy)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3398
	fgColor.red = 0;        /* fg is black */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3399
	fgColor.green = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3400
	fgColor.blue = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3401
	bgColor.red = 0xFFFF;   /* bg is white */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3402
	bgColor.green = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3403
	bgColor.blue = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3404
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3405
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3406
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3407
	newCursor = XCreatePixmapCursor(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3408
				__PixmapVal(sourceId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3409
				__PixmapVal(maskId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3410
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3411
	LEAVE_XLIB();
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3412
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3413
	if (newCursor)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3414
	    __cnt_cursor++;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3415
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3416
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3417
	if (newCursor != (Cursor)0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3418
	    RETURN (__MKEXTERNALADDRESS(newCursor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3419
	}
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3420
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3421
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3422
    self primitiveFailedOrClosedConnection.
3227
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3423
    ^ nil
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3424
!
c3a036f3df05 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3226
diff changeset
  3425
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3426
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3427
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3428
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3429
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  3430
    "/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
  3431
    "/ 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
  3432
6873
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3433
%{  /* NOCONTEXT */
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3434
    if (shape == @symbol(upLeftArrow)) RETURN ( __MKSMALLINT(XC_top_left_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3435
    if (shape == @symbol(upRightHand)) RETURN (  __MKSMALLINT(XC_hand1) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3436
    if (shape == @symbol(upDownArrow)) RETURN (  __MKSMALLINT(XC_sb_v_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3437
    if (shape == @symbol(leftRightArrow)) RETURN (  __MKSMALLINT(XC_sb_h_double_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3438
    if (shape == @symbol(upLimitArrow)) RETURN (  __MKSMALLINT(XC_top_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3439
    if (shape == @symbol(downLimitArrow)) RETURN (  __MKSMALLINT(XC_bottom_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3440
    if (shape == @symbol(leftLimitArrow)) RETURN (  __MKSMALLINT(XC_left_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3441
    if (shape == @symbol(rightLimitArrow)) RETURN (  __MKSMALLINT(XC_right_side) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3442
    if (shape == @symbol(text)) RETURN (  __MKSMALLINT(XC_xterm) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3443
    if (shape == @symbol(upRightArrow)) RETURN (  __MKSMALLINT(XC_draft_large) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3444
    if (shape == @symbol(leftHand)) RETURN (  __MKSMALLINT(XC_hand2) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3445
    if (shape == @symbol(questionMark)) RETURN (  __MKSMALLINT(XC_question_arrow) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3446
    if (shape == @symbol(cross)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3447
    if (shape == @symbol(wait)) RETURN (  __MKSMALLINT(XC_watch) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3448
    if (shape == @symbol(crossHair)) RETURN (  __MKSMALLINT(XC_tcross) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3449
    if ((shape == @symbol(origin)) || (shape == @symbol(topLeft))) RETURN (  __MKSMALLINT(XC_ul_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3450
    if ((shape == @symbol(corner)) || (shape == @symbol(bottomRight))) RETURN ( __MKSMALLINT(XC_lr_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3451
    if (shape == @symbol(topRight)) RETURN (  __MKSMALLINT(XC_ur_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3452
    if (shape == @symbol(bottomLeft)) RETURN (  __MKSMALLINT(XC_ll_angle) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3453
    if (shape == @symbol(square)) RETURN (  __MKSMALLINT(XC_dotbox) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3454
    if (shape == @symbol(fourWay)) RETURN (  __MKSMALLINT(XC_fleur) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3455
    if (shape == @symbol(crossCursor)) RETURN (  __MKSMALLINT(XC_X_cursor) );
126b64c8a9c9 simplified primitive
Claus Gittinger <cg@exept.de>
parents: 6768
diff changeset
  3456
%}.
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7416
diff changeset
  3457
"/    Logger info:'invalid cursorShape: %1' with:shape.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  3458
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3459
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3460
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3461
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3462
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3463
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3464
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3465
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3466
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  3467
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3468
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3469
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3470
    (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3471
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3472
	"/ DND can drop files, file, dir, links, dirLink and text
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3473
	"/ check for this.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3474
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3475
	dropObjects isCollection ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3476
	    dropColl := Array with:dropObjects
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3477
	] ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3478
	    dropColl := dropObjects
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3479
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3480
	anyFile := anyDir := anyText := anyOther := false.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3481
	dropColl do:[:aDropObject |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3482
	    aDropObject isFileObject ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3483
		aDropObject theObject isDirectory ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3484
		    anyDir := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3485
		] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3486
		    anyFile := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3487
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3488
	    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3489
		aDropObject isTextObject ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3490
		    anyText := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3491
		] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3492
		    anyOther := true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3493
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3494
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3495
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3496
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3497
	anyOther ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3498
	    "/ DND does not support this ...
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3499
	    Logger info:'DND can only drop files or text'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3500
	    ^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3501
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3502
	anyText ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3503
	    (anyFile or:[anyDir]) ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3504
		"/ DND does not support mixed types
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3505
		Logger info:'DND cannot drop both files and text'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3506
		^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3507
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3508
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3509
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3510
	dropCollSize := dropColl size.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3511
	anyFile ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3512
	    dropType := #DndFiles.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3513
	    dropCollSize == 1 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3514
		dropType := #DndFile
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3515
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3516
	] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3517
	    anyDir ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3518
		dropType := #DndFiles.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3519
		dropCollSize == 1 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3520
		    dropType := #DndDir
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3521
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3522
	    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3523
		anyText ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3524
		    dropCollSize == 1 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3525
			dropType := #DndText
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3526
		    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3527
			"/ can only drop a single text object
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3528
			Logger info:'DND can only drop a single text'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3529
			^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3530
		    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3531
		] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3532
		    "/ mhmh ...
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3533
		    Logger info:'DND cannot drop this'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3534
		    ^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3535
		]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3536
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3537
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3538
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3539
	dropTypeCode := self dndDropTypes indexOf:dropType.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3540
	dropTypeCode == 0 ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3541
	    Logger info:'DND cannot drop this'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3542
	    ^ false
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3543
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3544
	dropTypeCode := dropTypeCode - 1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3545
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
	"/ place the selection inTo the DndSelection property
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3548
	"/ of the rootView ...
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3549
	"/ ... need a single string, with 0-terminated parts.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3550
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3551
	strings := OrderedCollection new.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3552
	sz := 0.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3553
	dropColl do:[:anObject |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3554
	    |s o|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3555
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3556
	    o := anObject theObject.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3557
	    anObject isFileObject ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3558
		o := o pathName
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3559
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3560
	    s := o asString.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3561
	    strings add:s.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3562
	    sz := sz + (s size) + 1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3563
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3564
	val := String new:sz.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3565
	idx := 1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3566
	strings do:[:aString |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3567
	    |sz|
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
	    sz := aString size.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3570
	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3571
	    idx := idx + sz.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3572
	    val at:idx put:(Character value:0).
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3573
	    idx := idx + 1
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
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3576
	self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3577
	    setProperty:#DndSelection
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3578
	    type:#STRING
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3579
	    value:val
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3580
	    for:rootId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3581
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3582
	^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3583
	    sendClientEvent:msgType
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3584
	    format:32
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3585
	    to:destinationId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3586
	    propagate:true
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3587
	    eventMask:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3588
	    window:destinationId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3589
	    data1:dropTypeCode
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3590
	    data2:0
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3591
	    data3:destinationId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3592
	    data4:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  3593
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3594
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3595
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3596
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3597
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3598
    "Created: / 06-04-1997 / 13:39:37 / cg"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  3599
    "Modified: / 26-04-2018 / 10:54:18 / stefan"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3600
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3601
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3602
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3603
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3604
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3605
    ^ #(
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3606
	    DndUnknown      "/ 0
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3607
	    DndRawData      "/ 1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3608
	    DndFile         "/ 2
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3609
	    DndFiles        "/ 3
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3610
	    DndText         "/ 4
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3611
	    DndDir          "/ 5
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3612
	    DndLink         "/ 6
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3613
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3614
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3615
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3616
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3617
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3618
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3619
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3620
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3621
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3622
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3623
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3624
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3625
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3626
    "/
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  3627
    (self atomIDOf:#DndProtocol) notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3628
	^ self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3629
	    dndDrop:aCollectionOfDropObjects
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3630
	    inWindowID:destinationId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3631
	    position:destinationPoint
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3632
	    rootPosition:rootPoint
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3633
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3634
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3635
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3636
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3637
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  3638
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3639
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3640
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3641
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3642
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3643
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3644
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
  3645
    "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
  3646
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3647
    <context: #return>
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3648
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3649
    operationsUntilFlush notNil ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3650
	operationsUntilFlush <= 0 ifTrue:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3651
	    self flush.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3652
	] ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3653
	    operationsUntilFlush := operationsUntilFlush - 1.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3654
	].
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3655
    ].
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3656
%{
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3657
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3658
    int w, h;
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3659
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3660
    if (ISCONNECTED
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3661
     && __isExternalAddress(aDrawableId)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3662
     && __bothSmallInteger(x, y)
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3663
     && __bothSmallInteger(width, height)) {
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3664
	w = __intVal(width);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3665
	h = __intVal(height);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3666
	/*
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3667
	 * 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
  3668
	 */
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3669
	if ((w >= 0) && (h >= 0)) {
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3670
	    ENTER_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3671
	    XClearArea(myDpy,
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3672
			   __DrawableVal(aDrawableId),
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3673
			   __intVal(x), __intVal(y), w, h, 0);
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3674
	    LEAVE_XLIB();
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3675
	}
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
  3676
	RETURN ( self );
7416
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3677
    }
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3678
%}.
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3679
    "badGC, badDrawable or coordinates not integer"
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3680
    self primitiveFailedOrClosedConnection
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3681
!
bd3b9e9edd9e Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 7413
diff changeset
  3682
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3683
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
  3684
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3685
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3686
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3687
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3688
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3689
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3690
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3691
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3692
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3693
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3694
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3695
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3696
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3697
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3698
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3699
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3700
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3701
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3702
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3703
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3704
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3705
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3706
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3707
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3708
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3709
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3710
	int _sX, _sY, _w, _h, _dX, _dY;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3711
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3712
	_sX = __intVal(srcX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3713
	_sY = __intVal(srcY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3714
	_w = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3715
	_h = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3716
	_dX = __intVal(dstX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3717
	_dY = __intVal(dstY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3718
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3719
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3720
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3721
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3722
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3723
	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3724
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3725
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3726
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3727
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3728
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3729
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3730
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3731
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3732
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3733
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3734
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
  3735
    "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
  3736
     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
  3737
     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
  3738
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3739
     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
  3740
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3741
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3742
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3743
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3744
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3745
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3746
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3747
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3748
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3749
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3750
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3751
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3752
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3753
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3754
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3755
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3756
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3757
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3758
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3759
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3760
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3761
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3762
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3763
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3764
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3765
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3766
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3767
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3768
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3769
	XCopyArea(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3770
				__intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3771
				__intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3772
				__intVal(dstX), __intVal(dstY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3773
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3774
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3775
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3776
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3777
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3778
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3779
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3780
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3781
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3782
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3783
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  3784
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
  3785
    "do a bit-blt, but only copy the low-bit plane;
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3786
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3787
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3788
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3789
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3790
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3791
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3792
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3793
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3794
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3795
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3796
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3797
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3798
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3799
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3800
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3801
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3802
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3803
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3804
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3805
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3806
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3807
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3808
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3809
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3810
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3811
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3812
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3813
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3814
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3815
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3816
	XCopyPlane(myDpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3817
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3818
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3819
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3820
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3821
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3822
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3823
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3824
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3825
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3826
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3827
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3828
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3829
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3830
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
  3831
    "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
  3832
     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
  3833
     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
  3834
     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
  3835
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3836
     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
  3837
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3838
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3839
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3840
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3841
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3842
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3843
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3844
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3845
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3846
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3847
%{
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3848
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3849
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3850
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3851
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3852
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3853
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3854
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3855
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3856
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3857
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3858
     && __bothSmallInteger(dstX, dstY)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3859
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3860
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3861
	gc = __GCVal(dstGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3862
	source = __DrawableVal(sourceId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3863
	dest =   __DrawableVal(destId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3864
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3865
	XSetGraphicsExposures(dpy, gc, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3866
	XCopyPlane(dpy, source, dest, gc,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3867
				 __intVal(srcX), __intVal(srcY),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3868
				 __intVal(w), __intVal(h),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3869
				 __intVal(dstX), __intVal(dstY), 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3870
	XSetGraphicsExposures(dpy, gc, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3871
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3872
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3873
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3874
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3875
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3876
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3877
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3878
    self primitiveFailedOrClosedConnection
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3879
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3880
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3881
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
  3882
    "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
  3883
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3884
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3885
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3886
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3887
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3888
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3889
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3890
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3891
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3892
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3893
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  3894
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3895
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3896
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3897
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3898
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3899
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3900
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3901
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3902
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3903
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3904
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3905
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3906
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3907
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3908
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3909
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3910
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3911
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3912
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3913
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3914
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3915
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3916
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3917
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3918
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3919
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3920
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3921
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3922
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3923
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3924
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3925
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3926
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3927
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3928
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3929
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3930
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3931
	 * 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
  3932
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3933
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3934
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3935
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3936
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3937
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3938
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3939
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3940
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3941
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3942
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3943
    "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
  3944
     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
  3945
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3946
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3947
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3948
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3949
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
  3950
    "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
  3951
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3952
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3953
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  3954
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3955
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3956
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3957
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3958
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3959
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  3960
    ].
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  3961
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3962
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3963
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3964
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3965
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3966
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3967
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3968
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3969
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3970
     && __bothSmallInteger(x1, y1)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3971
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3972
	int ix0, iy0, ix1, iy1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3973
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3974
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3975
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3976
	ix0 = __intVal(x0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3977
	iy0 = __intVal(y0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3978
	ix1 = __intVal(x1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3979
	iy1 = __intVal(y1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3980
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3981
	/* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3982
	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3983
	else if (ix0 < -0x8000) ix0 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3984
	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3985
	else if (iy0 < -0x8000) iy0 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3986
	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3987
	else if (ix1 < -0x8000) ix1 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3988
	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3989
	else if (iy1 < -0x8000) iy1 = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3990
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3991
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3992
	if ((ix0 == ix1) && (iy0 == iy1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3993
	    /* little bit shorter X-lib message (better with slow connections...) */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3994
	    XDrawPoint(dpy, win, gc, ix0, iy0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3995
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3996
	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3997
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3998
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  3999
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4000
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4001
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4002
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4003
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4004
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4005
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4006
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
  4007
    "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
  4008
     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
  4009
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4010
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4011
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4012
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4013
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4014
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4015
    (noY := yValues size) < 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4016
	^ self
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4017
    ].
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4018
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4019
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4020
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4021
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4022
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4023
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4024
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4025
    ].
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4026
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4027
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4028
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4029
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4030
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4031
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4032
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4033
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4034
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4035
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4036
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4037
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4038
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4039
     && __isExternalAddress(aDrawableId) ) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4040
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4041
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4042
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4043
	if( __isSmallInteger(scaleY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4044
	    sY = (float) __intVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4045
	else if (__isFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4046
	    sY = __floatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4047
	else if (__isShortFloat(scaleY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4048
	    sY = __shortFloatVal( scaleY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4049
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4050
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4051
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4052
	    sY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4053
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4054
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4055
	if( __isSmallInteger(transY) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4056
	    tY = (float) __intVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4057
	else if (__isFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4058
	    tY = __floatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4059
	else if (__isShortFloat(transY))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4060
	    tY = __shortFloatVal( transY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4061
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4062
	    t = __SSEND0(transY, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4063
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4064
	    tY = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4065
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4066
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4067
	if( __isSmallInteger(startX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4068
	    x = (float) __intVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4069
	else if (__isFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4070
	    x = __floatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4071
	else if (__isShortFloat(startX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4072
	    x = __shortFloatVal( startX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4073
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4074
	    t = __SSEND0(startX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4075
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4076
	    x = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4077
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4078
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4079
	if( __isSmallInteger(stepX) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4080
	    step = (float) __intVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4081
	else if (__isFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4082
	    step = __floatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4083
	else if (__isShortFloat(stepX))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4084
	    step = __shortFloatVal( stepX );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4085
	else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4086
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4087
	    if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4088
	    step = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4089
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4090
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4091
	num = __intVal( noY );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4092
	if( num > 200 ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4093
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4094
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4095
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4096
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4097
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4098
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4099
	for( i = 0; i < num; ++i ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4100
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4101
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4102
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4103
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4104
	    if( __isFloat(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4105
		y = __floatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4106
	    else if( __isSmallInteger(yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4107
		y = (float) __intVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4108
	    else if( __isShortFloat( yA) )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4109
		y = __shortFloatVal( yA );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4110
	    else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4111
		t = __SSEND0(yA, @symbol(asFloat), 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4112
		if (! __isFloat(t)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4113
		y = __floatVal( t );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4114
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4115
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4116
	    px = (int) (x + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4117
	    py = (int) ((y * sY) + tY + 0.5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4118
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4119
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4120
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4121
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4122
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4123
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4124
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4125
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4126
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4127
	    x = x + step;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4128
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4129
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4130
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4131
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4134
	if( mustFree ) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4135
	    free( points );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4136
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4137
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4138
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4139
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4140
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4141
    if( mustFree )
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4142
	free( points );
3229
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4143
%}.
e83490cc4472 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  4144
    ^ 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
  4145
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  4146
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4147
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  4148
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4149
displayPointX:x y:y in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4150
    "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
  4151
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4152
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4153
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4154
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4155
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4156
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4157
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4158
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4159
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4160
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4161
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4162
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4163
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4164
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4165
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4166
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4167
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4168
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4169
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4170
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4171
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4172
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4173
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4174
	px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4175
	py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4176
	if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4177
	else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4178
	if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4179
	else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4180
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4181
	XDrawPoint(myDpy, win, gc, px, py);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4182
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4183
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4184
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4185
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4186
    "badGC, badDrawable or x/y not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4187
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4188
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4189
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4190
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4191
    "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
  4192
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4193
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4194
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4195
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4196
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4197
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
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
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4206
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
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;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4210
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4211
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4212
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4213
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4214
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4215
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4216
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4217
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4218
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4219
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4220
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4221
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4222
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4223
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4224
	 * avoid a (slow) malloc, if the number of points is small
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4225
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4226
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4227
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4228
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4229
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4230
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4231
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4232
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4233
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4234
	    int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4235
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4236
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4237
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4238
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4239
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4240
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4241
		goto fail;
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
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4244
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4245
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4246
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4247
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4248
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4249
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4250
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4251
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4252
	    points[i].x = px;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4253
	    points[i].y = py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4254
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4255
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4256
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4257
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4258
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4259
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4260
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4261
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4262
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4263
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4264
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4265
    if (mustFree)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4266
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4267
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4268
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4269
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4270
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4271
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4272
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
  4273
    "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
  4274
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4275
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4276
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4277
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4278
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4279
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4280
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4281
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4282
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4283
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4284
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4285
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4286
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4287
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4288
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4289
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4290
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4291
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4292
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4293
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4294
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4295
	int px, py;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4296
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4297
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4298
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4299
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4300
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4301
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4302
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4303
	 * 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
  4304
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4305
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4306
	    px = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4307
	    py = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4308
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4309
	    /* attention: coordinates in X are shorts and wrap; clamp here. */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4310
	    if (px > 0x7FFF) px = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4311
	    else if (px < -0x8000) px = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4312
	    if (py > 0x7FFF) py = 0x7FFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4313
	    else if (py < -0x8000) py = -0x8000;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4314
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4315
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4316
	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4317
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4318
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4319
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4320
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4321
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4322
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4323
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4324
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4325
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4326
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
  4327
    "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
  4328
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4329
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4330
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4331
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4332
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4333
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4334
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4335
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4336
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4337
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4338
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4339
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4340
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4341
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4342
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4343
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4344
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4345
    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
  4346
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4347
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4348
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4349
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4350
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4351
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4352
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4353
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4354
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4355
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4356
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4357
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4358
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4359
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4360
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4361
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4362
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4363
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4364
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4365
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4366
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4367
		RETURN (self);
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
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4370
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4371
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4372
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4373
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4374
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4375
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4376
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4377
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4378
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4379
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4380
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4381
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4382
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4383
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4384
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4385
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4386
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4387
	    cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4388
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4389
	    cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4390
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4391
	    if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4392
		n = __byteArraySize(aString) - nInstBytes - 1;
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
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4395
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4396
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4397
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4398
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4399
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4400
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4401
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4402
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4403
		    RETURN ( self );
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
	    }
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
	    /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4408
	    if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4409
		n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4410
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4411
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4412
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4413
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4414
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4415
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4416
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4417
		    int mustFree = 0;
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
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4420
		    if (l > lMax) l = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4421
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4422
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4423
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4424
		     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4425
		     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4426
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4427
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4428
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4429
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4430
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4431
		     * convert as required
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
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4434
		    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4435
# endif
6517
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 (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4438
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4439
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4440
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4441
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4442
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4443
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4444
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4445
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4446
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4447
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4448
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4449
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4450
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4451
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4452
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4453
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4454
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4455
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4456
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4457
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4458
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4459
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4460
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4461
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4462
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4463
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4464
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4465
	    /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4466
	    if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4467
		n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4468
		if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4469
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4470
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4471
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4472
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4473
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4474
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4475
		    int32 *ip;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4476
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4477
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4478
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4479
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4480
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4481
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4482
		     * 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
  4483
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4484
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4485
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4486
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4487
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4488
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4489
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4490
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4491
			int32 codePoint = ((int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4492
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4493
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4494
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4495
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4496
			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4497
			cp2[i].byte2 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4498
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4499
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4500
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4501
		    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4502
		    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4503
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4504
		    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4505
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4506
		    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4507
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4508
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4509
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4510
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4511
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4512
		    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4513
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4514
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4515
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4516
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4517
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4518
%}.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4519
    (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4520
	self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4521
	     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
  4522
	^ self.
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4523
    ].
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4524
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4525
    "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
  4526
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4527
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4528
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4529
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
  4530
    "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
  4531
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4532
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4533
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4534
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4535
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4536
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4537
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4538
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4539
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4540
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4541
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4542
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4543
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4544
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4545
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4546
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  4547
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4548
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4549
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4550
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4551
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4552
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4553
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4554
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4555
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4556
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4557
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4558
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4559
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4560
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4561
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4562
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4563
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4564
	cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4565
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4566
	if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4567
	    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4568
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4569
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4570
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4571
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4572
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4573
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4574
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4575
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4576
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4577
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4578
	cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4579
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4580
	cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4581
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4582
	if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4583
	    n = __byteArraySize(aString) - nInstBytes - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4584
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4585
	    if (n > lMax) n = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4586
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4587
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4588
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4589
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4590
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4591
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4592
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4593
	}
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
	/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4596
	if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4597
	    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4598
		char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4599
		unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4600
	    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4601
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4602
	    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4603
	    int mustFree = 0;
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
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4606
	    if (n > lMax) n = lMax;
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  4607
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4608
#if defined(MSBFIRST) || defined(__MSBFIRST)
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4609
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4610
	     * chars already in correct order
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4611
	     */
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4612
#else
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4613
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4614
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4615
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4616
	     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4617
	     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4618
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4619
	    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4620
	    if (u.b[0] != 0x12)
4029
959f7a19bc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4024
diff changeset
  4621
# endif
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4622
	    {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4623
		if (n <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4624
		    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4625
		} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4626
		    cp2 = (XChar2b *)(malloc(n * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4627
		    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4628
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4629
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4630
		for (i=0; i<n; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4631
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4632
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4633
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4634
		cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4635
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4636
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4637
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4638
	    if (opaque == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4639
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4640
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4641
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4642
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4643
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4644
	    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4645
		free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4646
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4647
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4648
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4649
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4650
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  4651
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4652
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4653
    ^ 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
  4654
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4655
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4656
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4657
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4658
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4659
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4660
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4661
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4662
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4663
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4664
    "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
  4665
     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
  4666
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4667
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4668
     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
  4669
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4670
     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
  4671
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4672
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4673
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4674
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4675
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4676
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4677
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4678
    "/ 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
  4679
    "/ 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
  4680
    "/ 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
  4681
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4682
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  4683
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4684
	fmt := self supportedImageFormatForDepth:4.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4685
	fmt isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4686
	    self primitiveFailed. "/ cannot represent this image
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4687
	    ^ nil
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4688
	].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4689
	wantedPadding := fmt at:#padding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4690
	wantedPadding > givenPadding ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4691
	    bits := self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4692
			    repadBits:givenBits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4693
			    width:imageWidth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4694
			    height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4695
			    depth:imageDepth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4696
			    from:givenPadding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4697
			    to:wantedPadding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4698
	    padding := wantedPadding.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4699
	]
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4700
    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4701
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4702
    self
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4703
	drawBits:bits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4704
	msb:true bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4705
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4706
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4707
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4708
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4709
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4710
	with:aGCId
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4711
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4712
    "Modified: / 11-04-2017 / 18:50:32 / cg"
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4713
!
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4714
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4715
drawBits:bits msb:msb bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4716
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4717
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4718
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4719
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4720
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4721
	with:aGCId
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4722
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4723
    "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
  4724
     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
  4725
     Individual source pixels have bitsPerPixel bits, allowing to draw
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4726
     depth and pixel-units to be different.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4727
     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
  4728
     depth - otherwise, primitive failure will be signalled.
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4729
     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
  4730
     colors are allocated - otherwise the colors may be wrong."
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4731
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4732
    operationsUntilFlush notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4733
	operationsUntilFlush <= 0 ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4734
	    self flush.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4735
	] ifFalse:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4736
	    operationsUntilFlush := operationsUntilFlush - 1.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4737
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4738
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4739
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4740
     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
  4741
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4742
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4743
    (self
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4744
	primDrawBits:bits
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4745
	bitsPerPixel:bitsPerPixel
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4746
	depth:imageDepth
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4747
	msb:msb
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4748
	padding:padding
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4749
	width:imageWidth height:imageHeight
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4750
	x:srcx y:srcy
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4751
	into:aDrawableId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4752
	x:dstx y:dsty
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4753
	width:w height:h
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4754
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4755
    ifFalse:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4756
	"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4757
	 also happens, if a segmentation violation occurs in the
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4758
	 XPutImage ...
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4759
	"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4760
	self primitiveFailedOrClosedConnection
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4761
    ].
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4762
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
  4763
    "Created: / 11-04-2017 / 18:49:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4764
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4765
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  4766
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
  4767
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4768
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4769
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4770
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4771
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4772
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4773
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4774
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4775
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4776
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4777
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4778
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4779
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4780
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4781
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4782
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4783
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4784
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4785
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4786
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4787
    if (__isSmallInteger(startAngle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4788
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4789
    else if (__isFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4790
	f = __floatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4791
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4792
    } else if (__isShortFloat(startAngle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4793
	f = __shortFloatVal(startAngle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4794
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4795
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4796
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4797
    if (__isSmallInteger(angle))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4798
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  4799
    else if (__isFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4800
	f = __floatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4801
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  4802
    } else if (__isShortFloat(angle)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4803
	f = __shortFloatVal(angle);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4804
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4805
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4806
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4807
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4808
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4809
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4810
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4811
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4812
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4813
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4814
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4815
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4816
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4817
	 * 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
  4818
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4819
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4820
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4821
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4822
				   w, h, angle1, angle2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4823
	    LEAVE_XLIB();
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
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4826
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4827
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4828
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4829
    "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
  4830
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4831
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4832
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4833
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4834
48194c26a46c Initial revision
claus
parents:
diff changeset
  4835
fillPolygon:aPolygon in:aDrawableId with:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4836
    "fill a polygon given by its points.
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  4837
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4838
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4839
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4840
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4841
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4842
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4843
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4844
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4845
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4846
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4847
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4848
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4849
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4850
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  4851
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4852
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  4853
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4854
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4855
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4856
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4857
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4858
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4859
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4860
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4861
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4862
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  4863
     && __isSmallInteger(numberOfPoints)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4864
	gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4865
	win = __WindowVal(aDrawableId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4866
	num = __intVal(numberOfPoints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4867
	if (num < 3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4868
	    RETURN ( self );
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
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4871
	 * avoid (slow) malloc, if not many points
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
	if (num > 100) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4874
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4875
	    if (! points) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4876
	    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4877
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4878
	    points = qPoints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4879
	for (i=0; i<num; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4880
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4881
	    if (! __isPoint(point)) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4882
	    x = _point_X(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4883
	    y = _point_Y(point);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4884
	    if (! __bothSmallInteger(x, y))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4885
		goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4886
	    points[i].x = __intVal(x);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4887
	    points[i].y = __intVal(y);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4888
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4889
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4890
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4891
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4892
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4893
	    free(points);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4894
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  4895
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4896
fail: ;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4897
	if (mustFree)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4898
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4899
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4900
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  4901
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4902
    self primitiveFailedOrClosedConnection
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4903
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  4904
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4905
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4906
    "fill a rectangle. If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4907
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4908
    <context: #return>
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4909
6153
19d2ead1d7ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6152
diff changeset
  4910
    operationsUntilFlush notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4911
	operationsUntilFlush <= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4912
	    self flush.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4913
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4914
	    operationsUntilFlush := operationsUntilFlush - 1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4915
	].
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  4916
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4917
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4918
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4919
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4920
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4921
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4922
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4923
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4924
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4925
     && __bothSmallInteger(width, height)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4926
	w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4927
	h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4928
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4929
	 * 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
  4930
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4931
	if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4932
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4933
	    XFillRectangle(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4934
			   __DrawableVal(aDrawableId), __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4935
			   __intVal(x), __intVal(y), w, h);
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
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  4938
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4939
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4940
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4941
    "badGC, badDrawable or coordinates not integer"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  4942
    self primitiveFailedOrClosedConnection
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4943
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  4944
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4945
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4946
    msb:msb masks:maskArray padding:bitPadding
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4947
    extent:imageExtent sourceOrigin:srcOrg
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4948
    into:aDrawableId
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4949
    destinationOrigin:dstOrg extent:dstExtent
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  4950
    with:aGCId
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4951
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4952
    <context: #return>
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4953
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4954
    |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4955
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4956
    imageWidth := imageExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4957
    imageHeight := imageExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4958
    rm := maskArray at:1.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4959
    gm := maskArray at:2.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4960
    bm := maskArray at:3.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4961
    srcx := srcOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4962
    srcy := srcOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4963
    dstx := dstOrg x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4964
    dsty := dstOrg y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4965
    w := dstExtent x.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4966
    h := dstExtent y.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4967
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  4968
    "since XPutImage may allocate huge amount of stack space
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4969
     (some implementations use alloca), this must run with unlimited stack."
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4970
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4971
%{  /* UNLIMITEDSTACK */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4972
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4973
    /*
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4974
     * need unlimited stack, since some Xlibs do a huge alloca in
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4975
     * XPutImage
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4976
     */
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4977
    GC gc;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4978
    Window win;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4979
    XImage image;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4980
    int imgWdth;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4981
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4982
    if (ISCONNECTED
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4983
     && __isExternalAddress(aGCId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4984
     && __isExternalAddress(aDrawableId)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4985
     && __bothSmallInteger(srcx, srcy)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4986
     && __bothSmallInteger(dstx, dsty)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4987
     && __bothSmallInteger(w, h)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4988
     && __bothSmallInteger(imageWidth, imageHeight)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4989
     && __bothSmallInteger(imageDepth, bitsPerPixel)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4990
     && __isSmallInteger(bitPadding)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4991
     && __bothSmallInteger(rm, gm)
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  4992
     && __isSmallInteger(bm)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  4993
     && __isByteArrayLike(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4994
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4995
	int pad = __intVal(bitPadding);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4996
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4997
	gc = __GCVal(aGCId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4998
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  4999
	if (! gc || !win)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5000
	    goto fail;
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5001
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5002
	console_printf("args ok\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5003
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5004
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5005
	image.width = imgWdth = __intVal(imageWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5006
	image.height = __intVal(imageHeight);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5007
	image.xoffset = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5008
	image.format = ZPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5009
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5010
	image.bitmap_unit = 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5011
	image.bitmap_bit_order = MSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5012
	image.bitmap_pad = pad;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5013
	image.depth = __intVal(imageDepth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5014
	image.bits_per_pixel = __intVal(bitsPerPixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5015
	image.red_mask = __intVal(rm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5016
	image.green_mask = __intVal(gm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5017
	image.blue_mask = __intVal(bm);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5018
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5019
	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
  5020
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5021
	switch (image.bits_per_pixel) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5022
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5023
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5024
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5025
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5026
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5027
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5028
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5029
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5030
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5031
	    default:
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5032
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5033
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5034
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5035
		goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5036
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5037
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5038
	/* ENTER_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5039
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5040
					__intVal(dstx), __intVal(dsty),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5041
					__intVal(w), __intVal(h));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5042
	/* LEAVE_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5043
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5044
	RETURN ( true );
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5045
    }
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5046
#ifdef ARGDEBUG
8061
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5047
    if (! __isExternalAddress(aGCId)) console_printf("GC\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5048
    if (! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5049
    if (! __isSmallInteger(srcx)) console_printf("srcx\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5050
    if (! __isSmallInteger(srcy)) console_printf("srcy\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5051
    if (! __isSmallInteger(dstx)) console_printf("dstx\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5052
    if (! __isSmallInteger(dsty)) console_printf("dsty\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5053
    if (! __isSmallInteger(w)) console_printf("w\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5054
    if (! __isSmallInteger(h)) console_printf("h\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5055
    if (! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5056
    if (! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5057
    if (! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5058
    if (! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5059
    if (! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5060
#endif
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5061
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5062
fail: ;
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5063
%}
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5064
.
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5065
    ^ false
8061
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5066
55f525acfbbd #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8053
diff changeset
  5067
    "Modified: / 08-08-2017 / 14:16:05 / cg"
3609
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5068
!
5742cce8a004 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3608
diff changeset
  5069
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5070
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5071
    msb:msb padding:bitPadding
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5072
    width:imageWidth height:imageHeight
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5073
    x:srcx y:srcy
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5074
    into:aDrawableId
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5075
    x:dstx y:dsty
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5076
    width:w height:h
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  5077
    with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5078
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5079
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  5080
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5081
    "since XPutImage may allocate huge amount of stack space
132
claus
parents: 129
diff changeset
  5082
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  5083
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5084
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5085
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5086
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5087
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5088
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5089
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5090
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5091
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5092
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  5093
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5094
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5095
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5096
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  5097
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5098
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5099
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5100
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5101
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  5102
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  5103
     && __isSmallInteger(bitPadding)
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  5104
     && __isByteArrayLike(imageBits)) {
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5105
	Display *dpy = myDpy;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5106
	int pad = __intVal(bitPadding);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5107
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5108
	gc = __GCVal(aGCId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5109
	win = __WindowVal(aDrawableId);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5110
	if (! gc || !win)
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5111
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5112
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5113
	console_printf("args ok\n");
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5114
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5115
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5116
	image.width = imgWdth = __intVal(imageWidth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5117
	image.height = __intVal(imageHeight);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5118
	image.xoffset = 0;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5119
	image.format = ZPixmap;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5120
	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5121
	image.bitmap_unit = 8;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5122
	image.bitmap_bit_order = MSBFirst;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5123
	image.bitmap_pad = pad;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5124
	image.depth = __intVal(imageDepth);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5125
	image.bits_per_pixel = __intVal(bitsPerPixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5126
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5127
	/*
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5128
	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
  5129
	*/
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5130
	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
  5131
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5132
	switch (image.bits_per_pixel) {
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5133
	    case 1:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5134
	    case 2:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5135
	    case 4:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5136
	    case 8:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5137
	    case 16:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5138
	    case 24:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5139
	    case 32:
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5140
		break;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5141
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5142
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5143
#ifdef ARGDEBUG
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5144
		console_printf("bits_per_pixel=%d\n",image.bits_per_pixel);
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5145
#endif
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5146
		goto fail;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5147
	}
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5148
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5149
	image.red_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5150
	image.green_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5151
	image.blue_mask = 0xFFFF;
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5152
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5153
	/* ENTER_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5154
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5155
					__intVal(dstx), __intVal(dsty),
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5156
					__intVal(w), __intVal(h));
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5157
	/* LEAVE_XLIB(); */
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5158
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5159
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  5160
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5161
#ifdef ARGDEBUG
8062
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5162
    if (! __isExternalAddress(aGCId)) console_printf("GC\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5163
    if (! __isExternalAddress(aDrawableId)) console_printf("aDrawableId\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5164
    if (! __isSmallInteger(srcx)) console_printf("srcx\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5165
    if (! __isSmallInteger(srcy)) console_printf("srcy\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5166
    if (! __isSmallInteger(dstx)) console_printf("dstx\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5167
    if (! __isSmallInteger(dsty)) console_printf("dsty\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5168
    if (! __isSmallInteger(w)) console_printf("w\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5169
    if (! __isSmallInteger(h)) console_printf("h\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5170
    if (! __isSmallInteger(imageWidth)) console_printf("imageWidth\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5171
    if (! __isSmallInteger(imageHeight)) console_printf("imageHeight\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5172
    if (! __isSmallInteger(imageDepth)) console_printf("imageDepth\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5173
    if (! __isSmallInteger(bitsPerPixel)) console_printf("bitsPerPixel\n");
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5174
    if (! __isByteArrayLike(imageBits)) console_printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5175
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  5176
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5177
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5178
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  5179
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5180
    ^ false
8062
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5181
abb27be500c2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8061
diff changeset
  5182
    "Modified: / 08-08-2017 / 14:16:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5183
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  5184
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5185
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5186
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5187
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
  5188
    "forward a buttonMotion event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5189
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5190
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5191
    self buttonMotion:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5192
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5193
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5194
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
  5195
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5196
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5197
    |logicalButton clickPosition|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5198
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5199
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5200
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5201
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5202
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5203
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5204
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5205
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5206
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5207
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5208
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5209
    logicalButton := buttonTranslation at:button ifAbsent:button.
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
  5210
3332
a9ada7dccdd6 Comment
Stefan Vogel <sv@exept.de>
parents: 3330
diff changeset
  5211
    "/ special for mouse-wheel implementation
3312
21eca9090ee2 mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
  5212
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5213
      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
  5214
      ^ self.
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5215
    ].
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5216
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5217
    logicalButton isInteger ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5218
	buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5219
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5220
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5221
    clickPosition := x @ y.
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5222
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5223
    (multiClickTimeDelta notNil
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5224
     and:[lastButtonPressTime notNil
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5225
     and:[time < (lastButtonPressTime + multiClickTimeDelta)
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5226
     and:[(clickPosition dist:lastButtonPressPosition) < 6]]]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5227
	lastButtonPressTime := time.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5228
	lastButtonPressPosition := clickPosition.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5229
	self buttonMultiPress:logicalButton x:x y:y view:view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5230
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5231
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5232
    lastButtonPressTime := time.
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5233
    lastButtonPressPosition := clickPosition.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5234
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5235
    view isNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5236
	"/ event arrived, after I destroyed it myself
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5237
	^ self
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5238
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5239
    (logicalButton == 1 and:[activateOnClick == true]) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5240
	"/ don't raise above an active popup view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5241
	(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5242
	    view topView raise.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5243
	]
8024
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5244
    ].
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5245
    self buttonPress:logicalButton x:x y:y view:view
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5246
ac6e7e8cd68c #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8004
diff changeset
  5247
    "Modified: / 09-05-2017 / 10:33:01 / stefan"
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5248
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5249
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5250
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
  5251
    "forward a buttonPress event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5252
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5253
    |logicalButton|
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5254
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5255
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5256
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5257
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5258
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5259
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5260
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5261
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5262
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5263
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5264
    "/ physical to logical button translation
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5265
    logicalButton := buttonTranslation at:button ifAbsent:button.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5266
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5267
    "/ special for HPs mouse-wheel implementation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5268
    (logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5269
      ^ self
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5270
    ].
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5271
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5272
    logicalButton isInteger ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5273
	buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
  5274
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5275
    self buttonRelease:logicalButton x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5276
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5277
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5278
clientMessage:targetView type:typeAtom format:format data:data
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5279
    |sensor|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5280
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5281
    targetView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5282
	"targetView is gone? Anyway, cannot do anything with this event..."
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5283
	^ self.
4527
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5284
    ].
8f1a6deabb5e Take care of non-existant view in #clientMessage:type:format:data:
Stefan Vogel <sv@exept.de>
parents: 4480
diff changeset
  5285
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5286
    "DND drag&drop protocol"
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5287
    (format == 32 and:[typeAtom == (self atomIDOf:#DndProtocol)]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5288
	self dndMessage:nil data:data view:targetView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5289
	^ self.
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5290
    ].
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5291
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5292
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5293
    "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
  5294
    sensor notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5295
	sensor clientMessage:typeAtom format:format eventData:data view:targetView
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5296
    ].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5297
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5298
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5299
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5300
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5301
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
  5302
    "forward a size-change event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5303
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5304
"/    anotherViewId notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5305
"/        |parentViewOrSelf|
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5306
"/        parentViewOrSelf := self viewFromId:anotherViewId.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5307
"/        parentViewOrSelf notNil ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5308
"/        ].
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5309
"/     ].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5310
    self configureX:x y:y width:w height:h view:view.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  5311
    aboveViewId notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5312
	|aboveView|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5313
	aboveView := self viewFromId:aboveViewId.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5314
	aboveView notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5315
	    "view is now on the top of the window stack"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5316
	    self coveredBy:view view:aboveView.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5317
	].
3603
3665199a413f #configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents: 3592
diff changeset
  5318
     ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5319
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5320
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5321
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
  5322
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5323
    view isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5324
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5325
	^ self
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5326
    ].
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5327
    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
  5328
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5329
    "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
  5330
    "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
  5331
!
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5332
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5333
dndMessage:event data:data view:targetView
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5334
    "handle a drag&drop protocol message"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5335
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5336
    |sensor property dropType dropValue propertyType|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5337
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5338
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5339
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5340
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5341
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5342
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5343
    property := self
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5344
		    getProperty:#DndSelection
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5345
		    from:rootId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5346
		    delete:false.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5347
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5348
    propertyType := property key.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5349
    dropValue := property value.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5350
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5351
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5352
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5353
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5354
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5355
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5356
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5357
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5358
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5359
    dropType == #DndFiles ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5360
	"/ actually, a list of fileNames
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5361
	dropValue firstOrNil isString ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5362
	    Logger info:'expected a string propertyValue in drop'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5363
	    ^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5364
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5365
	dropValue := dropValue collect:[:nm | nm asFilename].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5366
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5367
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5368
	dropValue isString ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5369
	    Logger info:'expected a string propertyValue in drop'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5370
	    ^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5371
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5372
	dropValue := dropValue asFilename.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5373
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5374
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5375
	dropValue isString ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5376
	    Logger info:'expected a string propertyValue in drop'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5377
	    ^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5378
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5379
	dropValue := dropValue asFilename.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5380
	dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5381
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5382
	(dropValue isString or:[dropValue isStringCollection]) ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5383
	    Logger info:'expected a string propertyValue in drop'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5384
	    ^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5385
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5386
	dropValue := dropValue asString.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5387
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5388
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5389
	dropValue isString ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5390
	    Logger info:'expected a string propertyValue in drop'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5391
	    ^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5392
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5393
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5394
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5395
	dropValue isString ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5396
	    Logger info:'expected a string propertyValue in drop'.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5397
	    ^ self
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5398
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5399
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5400
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5401
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  5402
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5403
	Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5404
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  5405
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5406
4528
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5407
    sensor := targetView sensor.
386af2509408 #clientMessage:type:format:data - check for nil targetView
Stefan Vogel <sv@exept.de>
parents: 4527
diff changeset
  5408
    "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
  5409
    sensor notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5410
	sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5411
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5412
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5413
    "Created: / 04-04-1997 / 17:59:37 / cg"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5414
    "Modified (format): / 25-04-2018 / 15:12:04 / stefan"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5415
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  5416
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5417
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
  5418
    "forward an expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5419
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5420
    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
  5421
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5422
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5423
focusIn:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5424
    "a view got the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5425
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5426
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5427
	"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
  5428
	self focusInView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5429
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5430
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5431
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5432
focusOut:view mode:mode detail:detail
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5433
    "a view lost the keyboard focus"
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5434
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5435
    mode ~~ 1 "NotifyGrab" ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5436
	"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
  5437
	self focusOutView:view
5234
416116f4deac #fcousInView:.. and #focusOutView:...
Stefan Vogel <sv@exept.de>
parents: 5227
diff changeset
  5438
    ].
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5439
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5440
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5441
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
  5442
    "forward a graphics-expose event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5443
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5444
    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
  5445
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5446
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5447
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
  5448
    "forward a key-press event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5449
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5450
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5451
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  5452
    "/ '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
  5453
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5454
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5455
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5456
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5457
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5458
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5459
    key isNil ifTrue:[
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  5460
	"/ 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
  5461
	"/ (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
  5462
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5463
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5464
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5465
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5466
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5467
    "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
  5468
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5469
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5470
    self keyPress:commonKey x:x y:y view:view.
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  5471
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  5472
    "Modified: / 28-07-2018 / 12:05:02 / Claus Gittinger"
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5473
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5474
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5475
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
  5476
    "forward a key-release event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5477
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5478
    |commonKey|
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5479
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5480
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5481
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5482
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5483
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5484
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5485
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5486
    key isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5487
	"/ happens sometimes on some systems
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5488
	"/ (alt-graph on sun has no keysym)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5489
	^ self
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5490
    ].
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5491
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5492
    eventRootY := rY.
4928
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5493
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5494
    "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
  5495
    commonKey := rawKeySymTranslation at:key ifAbsent:key.
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5496
4e457b74f5d2 Fix raw keysym translation.
Stefan Vogel <sv@exept.de>
parents: 4845
diff changeset
  5497
    self keyRelease:commonKey x:x y:y view:view.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5498
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5499
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5500
mappingNotify:view request:what event:eB
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5501
    "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5502
     Tell xlib about the fact."
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5503
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5504
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5505
	self refreshKeyboardMapping:eB.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5506
	"Maybe some of our modifiers have been changed"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5507
	self initializeModifierMappings.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5508
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5509
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5510
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5511
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5512
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
  5513
    "forward a pointer enter event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5514
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5515
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5516
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5517
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5518
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5519
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5520
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5521
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5522
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5523
    self pointerEnter:state x:x y:y view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5524
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5525
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5526
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
  5527
    "forward a pointer leave event for some view"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5528
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5529
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5530
    altDown := state bitTest:altModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5531
    metaDown := state bitTest:metaModifierMask.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5532
    shiftDown := state bitTest:(self shiftModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5533
    ctrlDown := state bitTest:(self ctrlModifierMask).
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5534
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5535
    eventRootX := rX.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5536
    eventRootY := rY.
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5537
    self pointerLeave:state view:view
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5538
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5539
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5540
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
  5541
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5542
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5543
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5544
    |selectionFetcher|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5545
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5546
    lastEventTime := time.
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  5547
    aView isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5548
	"event arrived, after aView has been destroyed"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5549
	^ self
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5550
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5551
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5552
"/    '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
  5553
"/    aView propertyChange:atom state:aSymbol.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5554
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5555
    "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
  5556
     be interested (for now, only XEmbedSiteView is)"
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5557
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5558
    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
  5559
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5560
    aSymbol ~~ #newValue ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5561
	"I am not interested in delete notifications"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5562
	^ self.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5563
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5564
    selectionFetcher := self findSelectionFetcher:aView drawableId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5565
    selectionFetcher notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5566
	selectionFetcher message:thisContext message.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5567
    ].
5746
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5568
1ba87f4f40ca Jan's changes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5741
diff changeset
  5569
    "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
  5570
    "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
  5571
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5572
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5573
selectionClear:aView selection:selectionID time:time
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5574
    "sent when another X-client has created a selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5575
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5576
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5577
    |selectionFetcher|
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5578
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5579
    lastEventTime := time.
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5580
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
  5581
    selectionHandlers notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5582
	selectionHandlers do:[:eachHandler |
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5583
	    eachHandler selectionClear:selectionID
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5584
	]
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5585
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5586
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5587
    aView isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5588
	"event arrived, after aView has been destroyed"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5589
	^ self
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5590
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5591
    selectionFetcher := self findSelectionFetcher:aView drawableId.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
  5592
    selectionFetcher notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5593
	selectionFetcher message:thisContext message.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5594
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5595
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5596
    "Modified: / 26-04-2018 / 11:00:30 / stefan"
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5597
!
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5598
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
  5599
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
  5600
    "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
  5601
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5602
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5603
    |selectionFetcher|
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5604
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5605
"/    Transcript show:'selectionNotify selID:'.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5606
"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5607
"/    Transcript show:' targetID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5608
"/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5609
"/    Transcript show:' propertyID:'.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5610
"/    Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5611
"/    Transcript showCR:''.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5612
"/    Transcript endEntry.
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
  5613
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5614
    lastEventTime := time.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5615
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5616
    aView isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5617
	"event arrived, after aView has been destroyed"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5618
	^ self
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5619
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5620
    selectionFetcher := self findSelectionFetcher:aView drawableId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5621
    selectionFetcher notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  5622
	selectionFetcher message:thisContext message.
7976
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5623
    ].
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5624
fe794c7f2caa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7965
diff changeset
  5625
    "Modified (format): / 14-03-2017 / 16:31:20 / cg"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  5626
    "Modified: / 26-04-2018 / 11:00:36 / stefan"
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5627
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  5628
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5629
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5630
    "sent by some other X-client to ask for the selection.
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5631
     This is a very X-specific mechanism."
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5632
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5633
    |selection property bufferGetSelector responseTargetID selectionTime|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5634
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5635
"/'Selection: ' print. (self atomName:selectionID) printCR. ' TargetId: ' print. (self atomName:targetID) printCR.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5636
"/' Property: ' print. (self atomName:propertyID) printCR. ' Requestor: ' print. requestorID printCR.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5637
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5638
    lastEventTime := time.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5639
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5640
    "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
  5641
    selectionID == primaryAtom ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5642
	bufferGetSelector := #getPrimaryBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5643
	selectionTime := primarySelectionTime.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5644
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5645
	bufferGetSelector := #getCopyBuffer.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5646
	selectionTime := clipboardSelectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5647
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5648
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5649
    (targetID == (self atomIDOf:#TIMESTAMP)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5650
	"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
  5651
	responseTargetID := self atomIDOf:#INTEGER.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5652
	selection := selectionTime.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5653
    ] ifFalse:[(targetID == (self atomIDOf:#TARGETS)) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5654
	"the other view wants to know which targets we support"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5655
	responseTargetID := self atomIDOf:#ATOM.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5656
	selection := self supportedTargetAtoms.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5657
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5658
	selection := self selectionBuffer:bufferGetSelector as:targetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5659
	responseTargetID := selection key.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5660
	selection := selection value.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
  5661
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5662
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5663
"/'Send selection: ' print. selection printCR.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5664
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5665
    property := propertyID.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5666
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5667
    selection isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5668
	"sending property None tells the client,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5669
	 that I could not convert"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  5670
"/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5671
	property := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5672
	responseTargetID := targetID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5673
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5674
	property == 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5675
	    "Support old (obsolete) clients requesting a None property.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5676
	     Set the propertyID to the targetID"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5677
	    property := responseTargetID.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5678
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5679
	self setProperty:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5680
	     type:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5681
	     value:selection
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5682
	     for:requestorID.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5683
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5684
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
  5685
    self sendNotifySelection:selectionID
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5686
	 property:property
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5687
	 target:responseTargetID
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5688
	 time:time
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5689
	 to:requestorID.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5690
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  5691
    "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
  5692
!
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
  5693
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5694
visibilityNotify:aView state:how
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5695
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5696
    aView notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5697
	aView visibilityChange:how
3232
aeda024f481d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3230
diff changeset
  5698
    ]
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5699
! !
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5700
3886
538d4ca3a587 method category rename
Claus Gittinger <cg@exept.de>
parents: 3885
diff changeset
  5701
!XWorkstation methodsFor:'event forwarding-ignored events'!
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5702
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5703
circulateNotify:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5704
    "sent, when the stacking order changes.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5705
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5706
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5707
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5708
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5709
circulateRequest:aView place:aSymbol
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5710
    "sent, when the stacking order is about to change.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5711
     ignored for now."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5712
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5713
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5714
colorMapNotify:aView state:aBoolean
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5715
    "sent, when another colormap is installed.
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5716
     This is a very X-specific mechanism."
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5717
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5718
    aView isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5719
	"/ event arrived, after I destroyed it myself
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5720
	^ self
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5721
    ].
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5722
    "/ not yet implemented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5723
    "/ aView colorMapChange
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5724
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5725
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5726
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
  5727
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5728
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5729
    "/ view configureRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5730
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5731
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5732
gravityNotify:aView x:x y:y
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5733
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5734
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5735
    "/ aView gravityNotify
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5736
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5737
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5738
keymapNotify:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5739
    "ignore for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5740
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5741
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5742
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5743
mapRequest:aView
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5744
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5745
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5746
    "/ aView mapRequest
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5747
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5748
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  5749
reparentedView:aView parentId:parentId x:x y:y
3856
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5750
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5751
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5752
    "/ aView reparented
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5753
!
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5754
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5755
resizeRequest:aView width:width height:height
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5756
    "ignored for now"
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5757
45fccc92d834 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 3814
diff changeset
  5758
    "/ aView resizeRequest
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5759
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  5760
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  5761
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5762
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5763
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5764
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5765
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5766
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5767
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5768
			 KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5769
			 PointerMotionMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5770
			 EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5771
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5772
			 PropertyChangeMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5773
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5774
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  5775
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5776
dispatchEvent:evArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5777
    "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
  5778
     to a message send here.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5779
     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
  5780
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  5781
    |viewId view evType arguments|
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5782
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5783
    viewId := evArray at:1.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5784
    viewId notNil ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5785
	viewId = lastId ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5786
	    view := lastView
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5787
	] ifFalse:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5788
	    view := self viewFromId:viewId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5789
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5790
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5791
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5792
    evType := evArray at:3.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5793
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5794
    (self respondsTo:evType) ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5795
	arguments := evArray copyFrom:3 to:(3 + evType argumentCount - 1).
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5796
	arguments at:1 put:view.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5797
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5798
	self perform:evType withArguments:arguments.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  5799
	^ true.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5800
    ].
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5801
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5802
    '********** unhandled event:' errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5803
    evType errorPrintCR. (evArray at:2) errorPrintCR.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  5804
    '********** see dispatchEvent' errorPrintCR.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5805
    ^ false
7959
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5806
9c588b83d970 #REFACTORING by mawalch
mawalch
parents: 7886
diff changeset
  5807
    "Modified: / 23-02-2017 / 19:57:57 / mawalch"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5808
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5809
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5810
dispatchEventFor:aViewIdOrNil withMask:eventMask
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5811
    "central event handling method:
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5812
     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
  5813
     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
  5814
     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
  5815
     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
  5816
     handled.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5817
     WARNING: this may block to wait for an event - you better check for a
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5818
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5819
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5820
    |eventArray|
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5821
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5822
    eventArray := Array new:13.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5823
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5824
    (self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5825
	AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5826
	    ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5827
	] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5828
	    self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5829
	]
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5830
    ].
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5831
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5832
    "Modified: 19.8.1997 / 17:10:42 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5833
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5834
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5835
dispatchExposeEventFor:aViewIdOrNil
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5836
    "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
  5837
     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
  5838
     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
  5839
     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
  5840
	      pending event before calling this."
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5841
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5842
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5843
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5844
    "Modified: 19.8.1997 / 17:10:26 / cg"
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5845
!
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  5846
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5847
dispatchLoop
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5848
    preWaitAction := [self flush].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  5849
    Processor addPreWaitAction:preWaitAction.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5850
    [
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5851
	super dispatchLoop
3778
77a339649f30 Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents: 3758
diff changeset
  5852
    ] ensure:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5853
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5854
	preWaitAction := nil.
3647
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5855
    ].
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5856
!
91340b09e045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  5857
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5858
dispatchPendingEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5859
    "central event handling method for modal operation.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5860
     (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
  5861
     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
  5862
     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
  5863
     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
  5864
     we only handle exposes until the graphicsExpose arrives.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5865
     Other systems may not need such a kludge"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5866
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5867
    "interested in exposes only ?"
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5868
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5869
    |eventArray|
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  5870
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5871
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5872
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5873
	    self dispatchExposeEventFor:dispatchingExpose
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5874
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5875
	^ self
6032
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  5876
    ].
608dc73d32d3 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6026
diff changeset
  5877
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5878
    [self eventPendingWithSync:false] whileTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5879
	eventArray isNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5880
	    eventArray := Array new:13.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5881
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5882
	(self getEventFor:nil withMask:nil into:eventArray) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5883
	    AbortOperationRequest handle:[:ex |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5884
		ex return
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5885
	    ] do:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5886
		self dispatchEvent:eventArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5887
		"/ multi-screen config: give others a chance
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5888
		"/ (needed because we run at high (non-timesliced) prio)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5889
		Processor yield.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5890
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5891
	].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5892
    ]
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5893
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5894
    "Modified: 19.8.1997 / 17:11:18 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5895
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5896
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5897
disposeEventsWithMask:aMask for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5898
    "dispose (throw away) specific events. If aWindowId is nil,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5899
     events matching the mask are thrown away regardless of which
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5900
     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
  5901
     view are flushed."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5902
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5903
    <context: #return>
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  5904
%{ /* UNLIMITEDSTACK */
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5905
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5906
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5907
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5908
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5909
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5910
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5911
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5912
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5913
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5914
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5915
	    win = __WindowVal(aWindowIdOrNil);
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  5916
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  5917
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5918
	} else {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  5919
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev))
7147
e914d0679641 silence gcc warning
Claus Gittinger <cg@exept.de>
parents: 7146
diff changeset
  5920
		;;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5921
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5922
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5923
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5924
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5925
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5926
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5927
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5928
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5929
eventMaskFor:anEventSymbol
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5930
    "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
  5931
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5932
%{  /* NOCONTEXT */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5933
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5934
    int m = 0;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5935
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5936
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5937
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5938
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5939
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5940
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5941
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5942
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5943
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5944
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5945
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5946
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5947
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5948
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5949
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5950
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5951
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5952
    else if (anEventSymbol == @symbol(substructureNotify)) m = SubstructureNotifyMask;
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  5953
    else if (anEventSymbol == @symbol(substructureRedirect)) m = SubstructureRedirectMask;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5954
    RETURN (__MKSMALLINT(m));
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5955
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5956
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5957
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5958
eventPending
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  5959
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5960
     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
  5961
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5962
    "/ ConservativeSync is required for some Xlib implementation,
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5963
    "/ 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
  5964
    "/ (especially Win32 & Xlib)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5965
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5966
    dispatchingExpose notNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  5967
	^ self exposeEventPendingFor:dispatchingExpose withSync:ConservativeSync
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  5968
    ].
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  5969
    ^ self eventPendingWithSync:ConservativeSync
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5970
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5971
    "Modified: / 28.4.1999 / 11:08:12 / cg"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5972
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5973
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5974
eventPending:anEventSymbol for:aWindowIdOrNil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5975
    "return true, if a specific event is pending"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5976
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5977
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5978
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5979
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5980
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5981
    "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
  5982
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5983
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5984
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5985
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5986
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5987
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5988
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5989
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5990
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  5991
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5992
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5993
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5994
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5995
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5996
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5997
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5998
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  5999
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6000
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6001
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6002
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6003
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6004
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6005
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6006
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6007
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6008
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6009
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6010
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6011
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6012
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6013
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6014
eventPendingWithSync:doSync
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6015
    "return true, if any event is pending.
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6016
     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
  6017
     before checking."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6018
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6019
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6020
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6021
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6022
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6023
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6024
	Display *dpy = myDpy;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6025
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6026
	if (XEventsQueued(dpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6027
	    RETURN (true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6028
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6029
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6030
	ENTER_XLIB();
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6031
	if (doSync == true) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6032
	    XSync(dpy, 0);      /* make certain everything is flushed */
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6033
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6034
	if (XEventsQueued(dpy, QueuedAfterFlush)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6035
	    rslt = true;
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6036
	}
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6037
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6038
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6039
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6040
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6041
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6042
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6043
eventQueued
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6044
    "return true, if any event is queued"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6045
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6046
    dispatchingExpose notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6047
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6048
    ].
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6049
    ^ self eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6050
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6051
    "Created: 12.12.1995 / 21:43:00 / stefan"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6052
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6053
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6054
eventQueuedAlready
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6055
    "return true, if any event is queued internally.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6056
     (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
  6057
      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
  6058
      the display connection)."
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6059
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6060
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6061
    if (ISCONNECTED) {
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6062
	if (XEventsQueued(myDpy, QueuedAlready)) {
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6063
	    RETURN(true);
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  6064
	}
7092
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6065
    }
9159201de216 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7086
diff changeset
  6066
    RETURN ( false );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6067
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6068
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6069
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6070
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6071
    "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
  6072
     or any view (if the arg is nil).
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6073
     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
  6074
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6075
    <context: #return>
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6076
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6077
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6078
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6079
    XEvent ev;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6080
    Window win;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6081
    int thereIsOne;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6082
    OBJ rslt = false;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6083
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6084
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6085
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6086
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6087
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6088
	if (doSync == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6089
	    XSync(dpy, 0);      /* make certain everything is flushed */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6090
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6091
	if (__isExternalAddress(aWindowIdOrNil)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6092
	    win = __WindowVal(aWindowIdOrNil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6093
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6094
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6095
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6096
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6097
	if (thereIsOne) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6098
	    XPutBackEvent(dpy, &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6099
	    rslt = true;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6100
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6101
	LEAVE_XLIB();
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6102
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6103
    RETURN ( rslt );
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6104
%}
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6105
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6106
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6107
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6108
    "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
  6109
     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
  6110
     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
  6111
     Returns true, if there was an event, false otherwise.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6112
     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
  6113
     before calling for it.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6114
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6115
     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
  6116
     the fields are:
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6117
	1:      windowID
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6118
	2:      eventType-ID
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6119
	3:      eventTypeSymbol
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6120
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6121
	4..     args
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6122
3948
d542be7c1cad debug for james
Claus Gittinger <cg@exept.de>
parents: 3920
diff changeset
  6123
     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
  6124
     handler method to allow UNLIMITEDSTACK here.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6125
     (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
  6126
      #dispatchEvent:, since it dispatches out into ST-methods).
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6127
    "
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6128
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6129
%{  /* UNLIMITEDSTACK */
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6130
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6131
    Display *dpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6132
    Window win, wWanted;
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6133
    long evMask;
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6134
    int returnValue;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6135
    XEvent ev;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6136
    OBJ eB;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6137
    KeySym keySym;
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6138
    unsigned char buffer[64];
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6139
    int i, nchars;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6140
    char *keySymString;
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6141
    OBJ arg, sym, t, windowID;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6142
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6143
    if (! ISCONNECTED) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6144
	RETURN (false);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6145
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6146
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6147
    dpy = myDpy;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6148
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6149
    ev.type = 0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6150
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6151
    if (__isSmallInteger(eventMask)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6152
	evMask = __intVal(eventMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6153
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6154
	evMask = ~0;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6155
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6156
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6157
    if (__isExternalAddress(aViewIdOrNil)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6158
	wWanted = __WindowVal(aViewIdOrNil);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6159
	returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6160
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6161
	if (evMask == ~0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6162
	    XNextEvent(dpy, &ev);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6163
	    returnValue = 1;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6164
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6165
	    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
  6166
	}
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6167
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6168
    if (!returnValue) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6169
	/* there is no event */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6170
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6171
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6172
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6173
    if (anEventArray == nil) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6174
	/* 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
  6175
	RETURN(true);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6176
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6177
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6178
    if (!__isArray(anEventArray)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6179
	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
  6180
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6181
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6182
    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
  6183
	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
  6184
	RETURN (false);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6185
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6186
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6187
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6188
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6189
#   define ae ((XAnyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6190
#   define ee ((XExposeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6191
#   define ke ((XKeyPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6192
#   define be ((XButtonPressedEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6193
#   define ce ((XConfigureEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6194
#   define cr ((XConfigureRequestEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6195
#   define me ((XMotionEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6196
#   define ele ((XCrossingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6197
#   define de ((XDestroyWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6198
#   define ve ((XVisibilityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6199
#   define fe ((XFocusChangeEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6200
#   define cre ((XCreateWindowEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6201
#   define mape ((XMappingEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6202
#   define gre ((XGravityEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6203
#   define rr ((XResizeRequestEvent *)&ev)
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6204
#   define rpe ((XReparentEvent *)&ev)
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6205
#   define cie ((XCirculateEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6206
#   define pe ((XPropertyEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6207
#   define sce ((XSelectionClearEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6208
#   define cme ((XColormapEvent *)&ev)
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6209
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6210
    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
  6211
	 && __isExternalAddress(t)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6212
	 && (__WindowVal(t) == ae->window)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6213
	windowID = t;
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6214
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6215
	windowID = __MKEXTERNALADDRESS(ae->window);
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6216
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6217
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6218
    __ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6219
    __ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type);
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6220
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6221
    switch (ev.type) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6222
	case KeyRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6223
	    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
  6224
	    goto keyPressAndRelease;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6225
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6226
	case KeyPress:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6227
	    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
  6228
	    /* FALL INTO */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6229
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6230
	keyPressAndRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6231
	    arg = nil;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6232
	    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
  6233
	    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
  6234
		|| (buffer[0] >= 0x80))) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6235
		arg = __MKCHARACTER(buffer[0]);
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6236
//            } else if (nchars > 2) {
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
  6237
//                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
  6238
	    } else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6239
		keySymString = XKeysymToString(keySym);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6240
		if (keySymString) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6241
		    arg = __MKSYMBOL(keySymString, 0);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6242
		}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6243
	    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6244
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6245
#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
  6246
	    if (arg == nil) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6247
		/* 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
  6248
		RETURN (false);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6249
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6250
#endif
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6251
	    __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
  6252
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6253
	    __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
  6254
	    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
  6255
	    __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
  6256
	    __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
  6257
	    __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
  6258
	    __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
  6259
	    __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
  6260
	    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
  6261
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6262
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6263
	case ButtonPress:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6264
	    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
  6265
	    goto buttonPressAndRelease;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6266
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6267
	case ButtonRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6268
	    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
  6269
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6270
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6271
	buttonPressAndRelease:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6272
	    __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
  6273
	    __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
  6274
	    __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
  6275
	    __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
  6276
	    __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
  6277
	    __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
  6278
	    __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
  6279
	    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
  6280
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6281
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6282
	case MotionNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6283
	    __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
  6284
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6285
	    __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
  6286
	    __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
  6287
	    __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
  6288
	    __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
  6289
	    __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
  6290
	    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
  6291
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6292
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6293
	case FocusIn:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6294
	    __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
  6295
	    goto focusInOut;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6296
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6297
	case FocusOut:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6298
	    __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
  6299
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6300
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6301
	focusInOut:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6302
	    __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
  6303
	    __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
  6304
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6305
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6306
	case EnterNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6307
	    __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
  6308
	    goto enterLeave;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6309
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6310
	case LeaveNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6311
	    __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
  6312
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6313
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6314
	enterLeave:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6315
	    __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
  6316
	    __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
  6317
	    __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
  6318
	    __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
  6319
	    __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
  6320
	    __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
  6321
	    __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
  6322
	    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
  6323
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6324
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6325
	case Expose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6326
	    __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
  6327
	    goto expose;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6328
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6329
	case GraphicsExpose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6330
	    __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
  6331
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6332
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6333
	expose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6334
	    __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
  6335
	    __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
  6336
	    __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
  6337
	    __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
  6338
	    __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
  6339
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6340
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6341
	case NoExpose:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6342
	    __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
  6343
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6344
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6345
	case VisibilityNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6346
	    __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
  6347
	    switch (ve->state) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6348
		case VisibilityUnobscured:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6349
		    __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
  6350
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6351
		case VisibilityPartiallyObscured:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6352
		    __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
  6353
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6354
		case VisibilityFullyObscured:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6355
		    __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
  6356
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6357
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6358
		    __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
  6359
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6360
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6361
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6362
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6363
	case CreateNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6364
	    __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
  6365
	    __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
  6366
	    __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
  6367
	    __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
  6368
	    __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
  6369
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6370
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6371
	case DestroyNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6372
	    __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
  6373
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6374
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6375
	case UnmapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6376
	    __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
  6377
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6378
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6379
	case MapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6380
	    __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
  6381
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6382
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6383
	case ConfigureNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6384
	    __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
  6385
	    __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
  6386
	    __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
  6387
	    __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
  6388
	    __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
  6389
	    __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
  6390
	    __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
  6391
	   __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
  6392
	    __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
  6393
	    if (ce->event != None) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6394
		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
  6395
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6396
	    if (ce->above != None) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6397
		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
  6398
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6399
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6400
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6401
	case GravityNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6402
	    __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
  6403
	    __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
  6404
	    __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
  6405
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6406
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6407
	case ResizeRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6408
	    __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
  6409
	    __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
  6410
	    __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
  6411
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6412
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6413
	case ConfigureRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6414
	    __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
  6415
	    __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
  6416
	    __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
  6417
	    __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
  6418
	    __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
  6419
	    __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
  6420
	    if (cr->above != None) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6421
		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
  6422
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6423
	    switch (cr->detail) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6424
		case Above:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6425
		    __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
  6426
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6427
		case Below:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6428
		    __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
  6429
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6430
		case TopIf:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6431
		    __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
  6432
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6433
		case BottomIf:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6434
		    __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
  6435
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6436
		case Opposite:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6437
		    __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
  6438
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6439
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6440
		    __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
  6441
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6442
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6443
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6444
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6445
	case CirculateNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6446
	    __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
  6447
	    goto circulate;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6448
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6449
	case CirculateRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6450
	    __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
  6451
	    /* fall into */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6452
	circulate:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6453
	    switch (cie->place) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6454
		case PlaceOnTop:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6455
		    __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
  6456
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6457
		case PlaceOnBottom:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6458
		    __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
  6459
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6460
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6461
		    __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
  6462
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6463
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6464
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6465
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6466
	case PropertyNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6467
	    __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
  6468
	    __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
  6469
	    switch (pe->state) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6470
		case PropertyNewValue:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6471
		    __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
  6472
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6473
		case PropertyDelete:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6474
		    __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
  6475
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6476
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6477
		    __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
  6478
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6479
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6480
	    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
  6481
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6482
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6483
	case SelectionClear:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6484
	    __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
  6485
	    __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
  6486
	    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
  6487
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6488
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6489
	case SelectionRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6490
	    /*
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6491
	     * someone wants the selection
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6492
	     */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6493
	    __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
  6494
	    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
  6495
	    __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
  6496
	    __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
  6497
	    __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
  6498
	    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
  6499
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6500
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6501
	case SelectionNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6502
	    /*
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6503
	     * 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
  6504
	     */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6505
	    __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
  6506
	    __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
  6507
	    __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
  6508
	    __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
  6509
	    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
  6510
	    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
  6511
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6512
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6513
	case ColormapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6514
	    __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
  6515
	    __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
  6516
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6517
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6518
	case ClientMessage:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6519
	    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
  6520
		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
  6521
		 || (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
  6522
		    __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
  6523
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6524
		}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6525
		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
  6526
		    __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
  6527
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6528
		}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6529
	    }
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
	     * any other client message
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6532
	     */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6533
	    __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
  6534
	    __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
  6535
	    __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
  6536
	    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
  6537
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6538
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6539
	case MappingNotify:
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[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
  6541
	    switch(mape->request) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6542
		case MappingModifier:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6543
		    arg = @symbol(mappingModifier);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6544
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6545
		case MappingKeyboard:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6546
		    arg = @symbol(mappingKeyboard);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6547
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6548
		case MappingPointer:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6549
		    arg = @symbol(mappingPointer);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6550
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6551
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6552
		    arg = __MKSMALLINT(mape->request);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6553
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6554
	    }
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[3] = arg;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6556
	    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
  6557
	    __STORE(anEventArray, t);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6558
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6559
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6560
	case KeymapNotify:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6561
	    __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
  6562
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6563
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6564
	case MapRequest:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6565
	    __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
  6566
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6567
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6568
	case ReparentNotify:
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[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
  6570
	    t = __MKEXTERNALADDRESS(rpe->parent);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6571
	    __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
  6572
	    __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
  6573
	    __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
  6574
	    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6575
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6576
	default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  6577
	    __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
  6578
	    break;
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6579
    }
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6580
#undef ae
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6581
#undef ee
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6582
#undef ke
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6583
#undef be
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6584
#undef ce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6585
#undef cr
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6586
#undef cre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6587
#undef cle
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6588
#undef gre
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6589
#undef me
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6590
#undef ewe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6591
#undef ele
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6592
#undef lwe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6593
#undef de
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6594
#undef mape
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6595
#undef ve
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6596
#undef fe
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6597
#undef rr
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
  6598
#undef rpe
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6599
#undef pe
3799
65c6905e1250 Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents: 3798
diff changeset
  6600
#undef cie
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6601
#undef sce
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6602
#undef cme
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6603
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6604
%}.
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6605
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
  6606
    ^ true
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6607
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  6608
    "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
  6609
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6610
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6611
handleAllEvents
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6612
    "from now on, handle any kind of event"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6613
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6614
    dispatchingExpose := nil
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6615
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6616
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6617
handleExposeOnlyFor:aView
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6618
    "from now on, handle expose events only"
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6619
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  6620
    dispatchingExpose := aView drawableId.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  6621
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  6622
    "Modified: / 26-04-2018 / 11:01:37 / stefan"
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6623
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6624
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6625
registerHotKeyForWindow:aDrawableId withId:anId modifiers:aModifier virtualKeyCode:aVirtualKeyCode
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6626
    "Defines a system-wide hotkey."
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6627
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6628
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6629
    "no-op until implemented"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6630
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6631
    ^ false.
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6632
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6633
    "Modified (comment): / 06-08-2018 / 15:37:45 / Claus Gittinger"
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6634
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6635
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6636
setEventMask:aMask in:aWindowId
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6637
    "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
  6638
     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
  6639
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6640
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6641
%{
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6642
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6643
    int mask;
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6644
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6645
    if (ISCONNECTED
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6646
     && __isExternalAddress(aWindowId)
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6647
     && __isSmallInteger(aMask)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6648
	mask = __intVal(aMask);
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6649
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6650
#ifdef OLD
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6651
	/* these may not be disabled */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6652
	mask |= ExposureMask | StructureNotifyMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6653
		KeyPressMask | KeyReleaseMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6654
		EnterWindowMask | LeaveWindowMask |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6655
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6656
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6657
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6658
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6659
	XSelectInput(myDpy, __WindowVal(aWindowId), mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6660
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6661
	RETURN ( self );
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6662
    }
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6663
%}.
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6664
    self primitiveFailedOrClosedConnection
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6665
!
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6666
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6667
startDispatch
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6668
    "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
  6669
6252
35df59ca8863 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  6670
    (dispatchProcess notNil and:[dispatchProcess isDead not]) ifTrue:[^ self].
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6671
    dispatchingExpose := nil.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  6672
    super startDispatch.
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6673
!
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6674
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6675
unregisterHotKeyForWindow:aDrawableId withId:anId
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6676
    "Release a system-wide hotkey."
6009
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6677
    <resource: #todo>
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6678
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6679
    "no-op until implemented. Since we never registered anything, the unregister succeeds"
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6680
220e00e49540 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6005
diff changeset
  6681
    ^ true.
8443
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6682
1edf0d3d7426 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 8436
diff changeset
  6683
    "Modified (comment): / 06-08-2018 / 15:37:41 / Claus Gittinger"
6294
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6684
!
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6685
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6686
viewIsRelevantInCheckForEndOfDispatch:aView
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6687
    aView == windowGroupWindow ifTrue:[^ false].
55a1757ee198 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6291
diff changeset
  6688
    ^ super viewIsRelevantInCheckForEndOfDispatch:aView
3319
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6689
! !
e3b21cba1c59 Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents: 3312
diff changeset
  6690
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6691
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6692
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6693
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
  6694
    "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
  6695
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6696
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6697
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6698
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6699
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6700
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6701
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6702
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6703
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6704
    "/ Event.xclient.format            = msgFormat;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6705
    "/ Event.xclient.window            = windowID;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6706
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6707
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6708
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6709
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6710
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6711
    "/
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6712
    "/ XSendEvent(dpy, targetWindowID, propagate, eventMask, &Event);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6713
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6714
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6715
%{
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6716
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6717
    int state;
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6718
    int __eventMask;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6719
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6720
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6721
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  6722
     && __isInteger(msgFormat)
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6723
     && (eventMask == nil || __isInteger(eventMask))
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
  6724
     && (__isExternalAddress(windowID) || __isInteger(windowID))
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6725
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6726
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6727
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6728
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6729
	Window targetWindow;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6730
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6731
	if (__isInteger(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6732
	    ev.xclient.data.l[0] = __longIntVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6733
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6734
	    if (__isExternalAddress(d1)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6735
		ev.xclient.data.l[0] = (INT)__externalAddressVal(d1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6736
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6737
		ev.xclient.data.l[0] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6738
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6739
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6740
	if (__isInteger(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6741
	    ev.xclient.data.l[1] = __longIntVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6742
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6743
	    if (__isExternalAddress(d2)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6744
		ev.xclient.data.l[1] = (INT)__externalAddressVal(d2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6745
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6746
		ev.xclient.data.l[1] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6747
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6748
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6749
	if (__isInteger(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6750
	    ev.xclient.data.l[2] = __longIntVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6751
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6752
	    if (__isExternalAddress(d3)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6753
		ev.xclient.data.l[2] = (INT)__externalAddressVal(d3);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6754
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6755
		ev.xclient.data.l[2] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6756
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6757
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6758
	if (__isInteger(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6759
	    ev.xclient.data.l[3] = __longIntVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6760
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6761
	    if (__isExternalAddress(d4)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6762
		ev.xclient.data.l[3] = (INT)__externalAddressVal(d4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6763
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6764
		ev.xclient.data.l[3] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6765
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6766
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6767
	if (__isInteger(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6768
	    ev.xclient.data.l[4] = __longIntVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6769
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6770
	    if (__isExternalAddress(d5)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6771
		ev.xclient.data.l[4] = (INT)__externalAddressVal(d5);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6772
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6773
		ev.xclient.data.l[4] = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6774
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6775
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6776
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6777
	if (__isExternalAddress(windowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6778
	    ev.xclient.window = __WindowVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6779
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6780
	    ev.xclient.window = (Window)__longIntVal(windowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6781
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6782
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6783
	if (__isExternalAddress(targetWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6784
	    targetWindow = __WindowVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6785
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6786
	    targetWindow = (Window)__longIntVal(targetWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6787
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6788
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6789
	ev.xclient.type              = ClientMessage;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6790
	ev.xclient.display           = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6791
	ev.xclient.message_type      = __longIntVal(msgType);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6792
	ev.xclient.format            = __longIntVal(msgFormat);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6793
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6794
	if (eventMask == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6795
	    __eventMask = NoEventMask;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6796
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6797
	    __eventMask = __longIntVal(eventMask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6798
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6799
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6800
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6801
	result = XSendEvent(dpy, targetWindow, (propagate == true ? True : False), __eventMask , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6802
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6803
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6804
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6805
	    DPRINTF(("bad status in sendClientEvent\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6806
	    RETURN ( false )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6807
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  6808
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6809
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6810
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6811
    self primitiveFailedOrClosedConnection.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6812
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6813
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  6814
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6815
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6816
    "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
  6817
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6818
     For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...);
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6819
     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
  6820
     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
  6821
     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
  6822
     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
  6823
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6824
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6825
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  6826
%{
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6827
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6828
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6829
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6830
    if (__isSmallInteger(stateMask)) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6831
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6832
    } else {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6833
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6834
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6835
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6836
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6837
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  6838
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isStringLike(keySymCodeOrButtonNr))
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6839
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6840
	Display *dpy = myDpy;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6841
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6842
	XEvent ev;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6843
	Window target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6844
	Status result;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6845
	KeySym keySym, *syms;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6846
	int screen = __intVal(__INST(screen));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6847
	int nSyms;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6848
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6849
	if ((typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6850
	 || (typeSymbol == @symbol(keyRelease))) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6851
	    if (__isStringLike(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6852
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6853
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6854
		if (__isCharacter(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6855
		    char s[2];
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6856
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6857
		    s[1] = '\0';
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6858
		    keySym = XStringToKeysym(s);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6859
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6860
		    if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6861
			keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6862
		    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6863
			goto notOk;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6864
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6865
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6866
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6867
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6868
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6869
	    if (stateMask == nil) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6870
		/*
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6871
		 * get the modifier from the keySym
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6872
		 */
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6873
		nSyms = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6874
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6875
		if (syms) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6876
		    int i;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6877
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6878
		    for (i=0; i<nSyms; i++) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6879
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6880
#ifdef MODIFIERDEBUG
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6881
			    console_printf("modifier-index is %d\n", i);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6882
#endif
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6883
			    if (i) state = (1 << (i-1));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6884
			    break;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6885
			}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6886
		    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6887
		    XFree(syms);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6888
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6889
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6890
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6891
	    if ((typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6892
	     || (typeSymbol == @symbol(buttonRelease))) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6893
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6894
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6895
		} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6896
		    ev.xbutton.button = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6897
		}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6898
	    } else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6899
		DPRINTF(("invalid sendEvent typeSymbol\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6900
		RETURN (false);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6901
	    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6902
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6903
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6904
	if (typeSymbol == @symbol(keyPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6905
	    ev.xany.type = KeyPress;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6906
	else if (typeSymbol == @symbol(keyRelease))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6907
	    ev.xany.type = KeyRelease;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6908
	else if (typeSymbol == @symbol(buttonPress))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6909
	    ev.xany.type = ButtonPress;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6910
	else if (typeSymbol == @symbol(buttonRelease))
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6911
	    ev.xany.type = ButtonRelease;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6912
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6913
	if (__isExternalAddress(targetId)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6914
	    target = __WindowVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6915
	} else {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6916
	    target = (Window) __longIntVal(targetId);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6917
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6918
	ev.xkey.window = target;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6919
	ev.xkey.same_screen = 1;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6920
	ev.xkey.subwindow = 0;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6921
	ev.xkey.root = RootWindow(dpy, screen);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6922
	ev.xkey.x = __intVal(xPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6923
	ev.xkey.y = __intVal(yPos);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6924
	ev.xkey.state = state;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6925
	ev.xkey.time = CurrentTime;
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6926
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6927
	ENTER_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6928
	result = XSendEvent(dpy, target, False, 0 , &ev);
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6929
	LEAVE_XLIB();
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6930
	if ((result == BadValue) || (result == BadWindow)) {
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6931
	    DPRINTF(("bad status\n"));
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6932
	    RETURN ( false )
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6933
	}
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6934
	RETURN (true)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6935
    }
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6936
  notOk: ;
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6937
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  6938
    self primitiveFailedOrClosedConnection.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6939
    ^ false
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6940
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6941
    "<<END
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6942
     |v|
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6943
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6944
     v := EditTextView extent:200@100.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6945
     v contents:'Hello world'.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6946
     v openAndWait.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6947
     v selectFromCharacterPosition:1 to:5.
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6948
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6949
     "/ CTRL-c
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6950
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6951
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6952
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6953
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6954
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6955
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6956
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6957
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6958
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6959
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6960
	 keyOrButton:'c'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6961
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6962
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6963
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6964
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6965
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6966
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6967
	 keyOrButton:'c'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6968
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6969
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6970
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6971
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6972
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6973
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6974
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6975
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6976
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6977
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6978
     "/ CTRL-v
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  6979
6567
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6980
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6981
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6982
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6983
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6984
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6985
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6986
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6987
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6988
	 sendKeyOrButtonEvent:#keyPress
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6989
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6990
	 keyOrButton:'v'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6991
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6992
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6993
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6994
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6995
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6996
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6997
	 keyOrButton:'v'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6998
	 state:(v device ctrlModifierMask)
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  6999
	 toViewId: v id.
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7000
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7001
     v device
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7002
	 sendKeyOrButtonEvent:#keyRelease
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7003
	 x:10 y:10
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7004
	 keyOrButton:#'Control'
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7005
	 state:0
803364ec1f7d grab/ungrabKey primitives (for hotkeys)
Claus Gittinger <cg@exept.de>
parents: 6551
diff changeset
  7006
	 toViewId: v id.
6551
eff1347ac76f class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6538
diff changeset
  7007
END"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7008
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7009
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7010
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7011
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7012
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7013
    "a basic method for X-font allocation; this method allows
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  7014
     any font to be acquired (even those not conforming to
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7015
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7016
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7017
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7018
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  7019
%{  /* STACK: 100000 */
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  7020
    /*** UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7021
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7022
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7023
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  7024
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  7025
     && __isStringLike(aFontName)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7026
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7027
	ENTER_XLIB();
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7028
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7029
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  7030
#ifdef COUNT_RESOURCES
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7031
	if (newFont)
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7032
	    __cnt_font++;
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7033
#endif
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7034
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7035
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7036
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7037
%}.
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  7038
    "/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7039
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7040
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7041
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7042
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7043
    "extract family, face, style and size from an
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7044
     X-font name
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7045
     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
  7046
      -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
  7047
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7048
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7049
    |family face style moreStyle fheight size
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7050
     resX resY registry encoding coding fields|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7051
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7052
    aString isNil ifTrue:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7053
    fields := aString asCollectionOfSubstringsSeparatedBy:$-.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7054
    fields size == 3 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7055
	"take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7056
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7057
	style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7058
	size := Number readFromString:(fields at:3) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7059
    ] ifFalse:[fields size == 2 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7060
	"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7061
	family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7062
	size := Number readFromString:(fields at:2) onError:[^ false].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7063
    ] ifFalse:[fields size >= 15 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7064
	family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7065
	face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7066
	style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7067
	style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7068
	    style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7069
	] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7070
	     style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7071
	] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7072
	     style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7073
	]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7074
	moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7075
	(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7076
	    style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7077
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7078
	fheight := fields at:8.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7079
	size := (Number readFromString:(fields at:9) onError:[^ false]) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7080
	resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7081
	resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7082
	registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7083
	encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7084
	coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7085
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7086
	^ false
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7087
    ]]].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7088
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7089
    ^ true
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7090
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7091
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7092
encodingOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7093
    "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
  7094
     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
  7095
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7096
    |props reg enc coll|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7097
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7098
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7099
    reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7100
    enc := props at:#'CHARSET_ENCODING' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7101
    coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7102
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7103
    reg notNil ifTrue:[ reg := self atomName:reg].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7104
    enc notNil ifTrue:[ enc := self atomName:enc].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7105
    coll notNil ifTrue:[ coll := self atomName:coll].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7106
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7107
    ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7108
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7109
     "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7110
       Screen current encodingOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7111
     "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7112
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7113
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7114
extentsOf:aString from:index1 to:index2 inFont:aFontId into:anArray
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7115
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7116
    <context: #return>
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7117
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7118
%{  /* UNLIMITEDSTACK */
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7119
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7120
    XFontStruct *f;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7121
    char *cp;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7122
    int len, n, i1, i2, l;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7123
#   define NLOCALBUFFER 200
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7124
    XChar2b xlatebuffer[NLOCALBUFFER];
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7125
    int nInstBytes;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7126
    int directionReturn, fontAscentReturn, fontDescentReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7127
    XCharStruct overAllReturn;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7128
    OBJ *resultArray;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7129
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7130
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7131
	 && __bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7132
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7133
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7134
	int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7135
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7136
	if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7137
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7138
	if (__isArray(anArray) && __arraySize(anArray) > 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7139
	    resultArray = __arrayVal(anArray);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7140
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7141
	    resultArray = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7142
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7143
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7144
	i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7145
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7146
	if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7147
	    OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7148
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7149
	    i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7150
	    if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7151
		RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7152
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7153
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7154
	    cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7155
	    l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7156
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7157
	    if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7158
		n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7159
		if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7160
		cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7161
		len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7162
					&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7163
					&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7164
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7165
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7166
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7167
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7168
		n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7169
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7170
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7171
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7172
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7173
		    cp += i1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7174
		    len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7175
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7176
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7177
		} else  if (__isWords(aString)) { /* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7178
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7179
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7180
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7181
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7182
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7183
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7184
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7185
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7186
		    n = n / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7187
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7188
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7189
		    cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7190
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7191
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7192
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7193
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7194
		     * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7195
		     * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7196
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7197
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7198
		    u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7199
		    if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7200
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7201
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7202
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7203
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7204
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7205
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7206
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7207
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7208
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7209
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7210
			cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7211
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7212
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7213
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7214
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7215
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7216
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7217
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7218
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7219
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7220
		} else if (__isLongs(aString)) { /* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7221
		    union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7222
			char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7223
			unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7224
		    } u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7225
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7226
		    XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7227
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7228
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7229
		    n = n / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7230
		    if (i2 >= n) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7231
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7232
		    cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7233
		    if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7234
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7235
		    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7236
		     * 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
  7237
		     * 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
  7238
		     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7239
		    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7240
			cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7241
		    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7242
			cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7243
			mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7244
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7245
		    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7246
			int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7247
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7248
			codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7249
			if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7250
			    codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7251
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7252
			cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7253
			cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7254
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7255
		    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7256
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7257
		    len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7258
					    &directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7259
					    &overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7260
		    if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7261
			free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7262
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7263
		} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7264
		    goto fail;      /*unknown string class */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7265
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7266
	    if (resultArray) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7267
		switch (__arraySize(anArray)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7268
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7269
		case 8:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7270
		    resultArray[7] = __MKSMALLINT(directionReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7271
		case 7:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7272
		    resultArray[6] = __MKSMALLINT(fontDescentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7273
		case 6:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7274
		    resultArray[5] = __MKSMALLINT(fontAscentReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7275
		case 5:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7276
		    resultArray[4] = __MKSMALLINT(overAllReturn.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7277
		case 4:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7278
		    resultArray[3] = __MKSMALLINT(overAllReturn.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7279
		case 3:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7280
		    resultArray[2] = __MKSMALLINT(overAllReturn.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7281
		case 2:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7282
		    resultArray[1] = __MKSMALLINT(overAllReturn.rbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7283
		case 1:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7284
		    resultArray[0] = __MKSMALLINT(overAllReturn.lbearing);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7285
		case 0:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7286
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7287
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7288
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7289
	    RETURN ( __MKSMALLINT(overAllReturn.width) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7290
	}
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7291
    }
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7292
#undef NLOCALBUFFER
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7293
fail: ;
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7294
%}.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7295
    self primitiveFailedOrClosedConnection.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7296
    ^ 0
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7297
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7298
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7299
      |result|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7300
      result := Array new:8.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7301
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7302
	extentsOf:'hello World' from:1 to:11
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7303
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7304
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7305
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7306
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7307
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7308
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7309
		    size:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7310
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7311
	    )
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7312
	into:result.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7313
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7314
      result
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7315
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7316
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7317
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7318
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
  7319
    "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
  7320
     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
  7321
     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
  7322
     This is pure magic ..."
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7323
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7324
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7325
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7326
    (registry size ~~ 0) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7327
	enc := registry asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7328
	encoding size ~~ 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7329
	   enc := enc, '-', encoding asLowercase.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7330
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7331
	enc := enc asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7332
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7333
	(encoding size ~~ 0) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7334
	    enc := encoding asLowercase asSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7335
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7336
	    charSets := charSetCollections.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7337
	    (charSets notEmptyOrNil) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7338
		charSets := charSets asUppercase asCollectionOfWords.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7339
		(charSets includes:'ISO8859-1') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7340
		    enc := #'iso8859-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7341
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7342
		    (charSets includes:'ISO8859') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7343
			enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7344
		    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7345
			(charSets includes:'ASCII') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7346
			    enc := #ascii
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7347
			] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7348
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7349
				enc := #iso8859
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7350
			    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7351
			]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7352
		    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7353
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7354
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7355
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7356
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7357
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7358
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  7359
    "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
  7360
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7361
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7362
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7363
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7364
    "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
  7365
     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
  7366
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7367
    listOfXFonts := nil.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7368
    XftFontDescription notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7369
	XftFontDescription flushListOfAvailableFonts.
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  7370
    ].
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7371
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7372
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7373
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7374
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7375
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7376
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7377
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7378
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7379
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7380
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7381
fontDescriptionFromXFontName:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7382
    "extract family, face, style and size from an
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7383
     X-font name
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7384
     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
  7385
      -brand-family-face-style-moreStyle- -pxlSize-size-resX-resY-??-??-registry-encoding;
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7386
     evaluate aBlock with these"
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7387
6010
6d7184a6456b cast to correct types
Stefan Vogel <sv@exept.de>
parents: 6009
diff changeset
  7388
    |family face style moreStyle size
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7389
     resX resY registry encoding coding fields|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7390
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7391
    aFontNameString isNil ifTrue:[^ nil].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7392
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7393
    Error handle:[:ex |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7394
	family := nil.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7395
    ] do:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7396
	fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7397
	fields size == 3 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7398
	    "take care of old font names: family-style-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7399
	    family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7400
	    style := fields at:2.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7401
	    size := Number readFromString:(fields at:3).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7402
	] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7403
	    fields size == 2 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7404
		"take care of old font names: family-size"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7405
		family := fields at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7406
		size := Number readFromString:(fields at:2).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7407
	    ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7408
		fields size >= 15 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7409
		    family := fields at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7410
		    face := fields at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7411
		    style := fields at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7412
		    style = 'o' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7413
			style := 'oblique'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7414
		    ] ifFalse:[style = 'i' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7415
			 style := 'italic'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7416
		    ] ifFalse:[style = 'r' ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7417
			 style := 'roman'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7418
		    ]]].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7419
		    moreStyle := fields at:6.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7420
		    (moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7421
			style := style, '-', moreStyle.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7422
		    ].
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7423
"/                    pxlSize := (Integer readFromString:(fields at:8)).
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7424
		    size := (Number readFromString:(fields at:9)) / 10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7425
		    resX := fields at:10.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7426
		    resY := fields at:11.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7427
		    registry := fields at:14.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7428
		    encoding := fields at:15.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7429
		    coding := registry , '-' , encoding.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7430
		] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7431
		    "/ very old name (such as cursor, 5x7 etc)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7432
		]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7433
	    ]
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7434
	].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7435
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7436
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7437
    family notNil ifTrue:[
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7438
       ^ 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
  7439
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7440
    ^ FontDescription name:aFontNameString
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7441
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7442
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7443
     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
  7444
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7445
!
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7446
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7447
fontMetricsOf:fontId
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7448
    "return a fonts metrics info object"
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7449
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7450
    <context: #return>
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7451
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7452
    |info avgAscent avgDescent minCode maxCode dir
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7453
     maxAscent maxDescent minWidth maxWidth avgWidth|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7454
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  7455
%{  /* UNLIMITEDSTACK */
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7456
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7457
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7458
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  7459
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7460
	if (__isExternalAddress(fontId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7461
	    f = __FontVal(fontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7462
	    if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7463
		minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7464
		maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7465
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7466
		if (f->direction == FontLeftToRight) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7467
		    dir = @symbol(LeftToRight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7468
		} else if (f->direction == FontRightToLeft) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7469
		    dir = @symbol(RightToLeft);
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
		avgAscent = __MKSMALLINT(f->ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7472
		avgDescent = __MKSMALLINT(f->descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7473
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7474
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7475
		minWidth = __MKSMALLINT(f->min_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7476
		maxWidth = __MKSMALLINT(f->max_bounds.width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7477
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7478
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7479
		len = XTextWidth(f, "n", 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7480
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7481
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7482
		avgWidth = __MKSMALLINT( len );
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
	}
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7485
    }
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  7486
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7487
    avgAscent == nil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7488
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7489
	^ nil
3670
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7490
    ].
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7491
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7492
    "DingBats font returns 0 for maxAscent/maxDescent"
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7493
    maxAscent := maxAscent max:avgAscent.
f61f690d281c maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents: 3650
diff changeset
  7494
    maxDescent := maxDescent max:avgDescent.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7495
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7496
    info := DeviceWorkstation::DeviceFontMetrics new.
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7497
    info
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7498
      ascent:avgAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7499
      descent:avgDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7500
      maxAscent:maxAscent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7501
      maxDescent:maxDescent
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7502
      minWidth:minWidth
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7503
      maxWidth:maxWidth
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7504
      avgWidth:avgWidth
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7505
      minCode:minCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7506
      maxCode:maxCode
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7507
      direction:dir.
3478
b9d198097d10 fontMetric stuff changed
Claus Gittinger <cg@exept.de>
parents: 3468
diff changeset
  7508
    ^ info
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7509
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7510
    "
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7511
     Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7512
     CharacterSetView openOn:(View defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7513
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7514
     Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7515
     CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current)
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7516
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7517
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7518
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7519
fontProperties:propertyNames of:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7520
    "Answer an array with selected property values of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7521
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7522
     PropertyNames is an array with property names (symbols or strings).
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
  7523
     Nonexistent properties are returned as nil"
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7524
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7525
    |props|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7526
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7527
    props := self fontPropertiesOf:aFontId.
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7528
    ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7529
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7530
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7531
     Screen current
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7532
	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistent)
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7533
	of:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7534
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7535
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7536
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7537
fontPropertiesOf:aFontId
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7538
    "Answer an array with all the properties of a font.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7539
     This is X11-Specific.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7540
     Odd indices contain the property name (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7541
     Even indices contain the property value (atom)
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7542
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7543
     Answer nil, if there are no properties"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7544
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7545
    |propsArray result|
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7546
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7547
%{
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7548
    XFontStruct *f;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7549
    XFontProp *prop;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7550
    int n, i;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7551
    OBJ x;
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7552
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7553
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7554
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7555
	if (f && (prop = f->properties) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7556
	    n = f->n_properties;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7557
	    propsArray = __ARRAY_NEW_INT(n*2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7558
	    for (i = 0; n; n--, prop++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7559
		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
  7560
		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
  7561
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7562
	}
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7563
    }
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7564
%}.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7565
    result := Dictionary new.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7566
    propsArray notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7567
	propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v].
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7568
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7569
    ^ result
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7570
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7571
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7572
     Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7573
     Dictionary withKeysAndValues:(Screen current fontPropertiesOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1'))
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7574
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7575
     |d|
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7576
     d := Dictionary new.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7577
     (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
  7578
	  d at:name put:((Screen current atomName:value) ? value)
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7579
     ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7580
     d
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7581
    "
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7582
!
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7583
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7584
fontResolutionOf:fontId
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7585
    "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
  7586
     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
  7587
     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
  7588
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7589
    |props res resX resY|
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7590
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7591
    props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7592
    resX := props at:1.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7593
    resY := props at:2.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  7594
    (resX notNil and:[resY notNil]) ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  7595
	^ resX @ resY
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7596
    ].
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7597
    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
  7598
    res notNil ifTrue:[
8162
5f5abe24389b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8160
diff changeset
  7599
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7600
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7601
    ^ self resolution
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7602
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7603
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7604
      Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7605
    "
8160
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7606
44372900d464 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8156
diff changeset
  7607
    "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
  7608
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  7609
3417
88c4df032e94 Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  7610
fullFontNameOf:aFontId
7348
7c39d56e9beb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7313
diff changeset
  7611
    "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
  7612
     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
  7613
     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
  7614
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7615
    |props fullName|
4012
956fc93c6381 fontName
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  7616
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7617
    props := self fontPropertiesOf:aFontId.
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7618
    #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7619
	|fullNameID|
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7620
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7621
	fullNameID := props at:try ifAbsent:nil.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7622
	fullNameID notNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7623
	    fullName := self atomName:fullNameID.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7624
	    fullName notEmptyOrNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7625
		^ fullName
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7626
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7627
	]
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7628
    ].
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7629
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7630
    ^ nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7631
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7632
    "
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7633
     Screen current fullFontNameOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7634
    "
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7635
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  7636
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7637
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7638
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7639
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7640
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  7641
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7642
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7643
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7644
    int nnames = 30000;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7645
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7646
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7647
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7648
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7649
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7650
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7651
	if (__isStringLike(pattern)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7652
	    for (;;) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7653
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7654
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7655
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7656
		if (fonts == 0) RETURN(nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7657
		if (available < nnames) break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7658
		XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7659
		nnames = available * 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7660
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7661
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7662
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7663
	     * now, that we know the number of font names,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7664
	     * create the array ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7665
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7666
	    arr = __ARRAY_NEW_INT(available);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7667
	    if (arr != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7668
		/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7669
		 * ... and fill it
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7670
		 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7671
		for (i=0; i<available; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7672
		    __PROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7673
		    str = __MKSTRING(fonts[i]);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7674
		    __UNPROTECT__(arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7675
		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7676
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7677
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7678
	    XFreeFontNames(fonts);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7679
	    RETURN (arr);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7680
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7681
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7682
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7683
    ^ nil
3801
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7684
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7685
    "
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7686
      Screen current getAvailableFontsMatching:'*'
9efc83cc0da0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3800
diff changeset
  7687
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7688
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7689
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7690
getDefaultFontWithEncoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7691
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7692
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7693
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7694
    |id|
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7695
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7696
    id := self createFontFor:'-misc-fixed-*-*-*-*-*-*-*-*-*-*-', encoding.
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7697
    id isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7698
	id := self createFontFor:'fixed'
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7699
    ].
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7700
    ^ id.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7701
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7702
     "
5908
a5afc7a1721a added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents: 5905
diff changeset
  7703
       Screen current getDefaultFontWithEncoding:#'iso10646-1'
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7704
     "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7705
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7706
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7707
getFontWithFamily:familyString face:faceString
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7708
	    style:styleArgString size:sizeArgOrNil sizeUnit:sizeUnit encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7709
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7710
    "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
  7711
     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
  7712
     as family and the other parameters as nil. For example, the cursor font
7409
2de3e4caafbb #OTHER by mawalch
mawalch
parents: 7371
diff changeset
  7713
     can be acquired that way."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7714
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7715
    |styleString theName theId xlatedStyle
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7716
     id spacing encodingMatch idx roundedSize pixelSize pointSize|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7717
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7718
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7719
5176
0c9f21d81a71 preps for pixel-sized fonts
Claus Gittinger <cg@exept.de>
parents: 5071
diff changeset
  7720
    sizeArgOrNil notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7721
	roundedSize := sizeArgOrNil rounded asInteger.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7722
	sizeUnit == #px ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7723
	    pixelSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7724
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7725
	    pointSize := roundedSize.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7726
	].
3990
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  7727
    ].
5d9342503bf6 font stuff
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  7728
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7729
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7730
    faceString isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7731
	roundedSize notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7732
	    theName := familyString , '-' , roundedSize printString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7733
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7734
	    theName := familyString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7735
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7736
	theName notNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7737
	    theId := self createFontFor:theName.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7738
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7739
	theId isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7740
	    theId := self getDefaultFontWithEncoding:encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7741
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7742
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7743
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7744
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7745
    "/ 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
  7746
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7747
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  7748
    (styleString notNil
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7749
     and:[(styleString endsWith:'-narrow')
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7750
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7751
	|i|
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7752
	i := styleString lastIndexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7753
	spacing := styleString copyFrom:(i+1).
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7754
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7755
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7756
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7757
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7758
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7759
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7760
    xlatedStyle notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7761
	xlatedStyle := xlatedStyle first asString
3449
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  7762
    ].
da32a634ca80 Fix name tohuwabohu
Stefan Vogel <sv@exept.de>
parents: 3424
diff changeset
  7763
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7764
    encoding isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7765
	encodingMatch := '*-*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7766
    ] ifFalse:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7767
	idx := encoding indexOf:$-.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7768
	idx ~~ 0 ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7769
	    encodingMatch := encoding
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7770
	] ifFalse:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7771
	    encodingMatch := encoding , '-*'.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7772
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7773
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7774
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7775
    id := self
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7776
	    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7777
	    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7778
	    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7779
	    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7780
	    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7781
	    pixelSize:pixelSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7782
	    size:pointSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7783
	    encoding:encodingMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7784
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7785
    id isNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7786
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7787
	    "/ too stupid: registries come in both cases
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7788
	    "/ and X does not ignore case
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7789
	    "/
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7790
	    id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7791
		    getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7792
		    family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7793
		    weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7794
		    slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7795
		    spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7796
		    pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7797
		    size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7798
		    encoding:encodingMatch asUppercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7799
	    id isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7800
		id := self
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7801
			getFontWithFoundry:'*'
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7802
			family:familyString asLowercase
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7803
			weight:faceString
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7804
			slant:xlatedStyle
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7805
			spacing:spacing
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7806
			pixelSize:nil
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7807
			size:roundedSize
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7808
			encoding:encodingMatch asLowercase.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7809
	    ]
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
  7810
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7811
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7812
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7813
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  7814
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7815
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7816
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7817
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7818
getFontWithFoundry:foundry family:family weight:weight
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7819
	      slant:slant spacing:spc pixelSize:pSize size:size
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7820
	      encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7821
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7822
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7823
     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
  7824
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7825
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7826
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7827
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7828
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7829
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7830
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7831
     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
  7832
     encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7833
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7834
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7835
    |theName sizeMatch
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7836
     foundryMatch familyMatch weightMatch slantMatch spcMatch
4004
349680545ec4 treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents: 3990
diff changeset
  7837
     pSizeMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7838
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7839
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7840
    "name is:
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7841
	-foundry-family    -weight -slant-
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7842
	 sony    helvetica bold     r
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7843
	 adobe   courier   medium   i
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7844
	 msic    fixed              o
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7845
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7846
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7847
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7848
    size isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7849
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7850
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7851
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7852
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7853
    foundry isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7854
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7855
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7856
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7857
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7858
    family isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7859
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7860
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7861
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7862
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7863
    weight isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7864
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7865
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7866
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7867
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7868
    slant isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7869
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7870
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7871
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7872
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7873
    spc isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7874
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7875
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7876
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7877
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7878
    pSize isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7879
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7880
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7881
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7882
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7883
    encoding isNil ifTrue:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7884
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7885
    ] ifFalse:[
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7886
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7887
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7888
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7889
    theName := ('-' , foundryMatch,
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7890
		'-' , familyMatch,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7891
		'-' , weightMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7892
		'-' , slantMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7893
		'-' , spcMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7894
		'-*' ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7895
		'-' , pSizeMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7896
		'-' , sizeMatch ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7897
		'-*-*-*-*' ,
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7898
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7899
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  7900
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7901
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7902
    ^ self createFontFor:theName.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7903
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7904
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7905
    "
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  7906
     Display
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7907
	getFontWithFoundry:'*'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7908
	family:'courier'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7909
	weight:'medium'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7910
	slant:'r'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7911
	spacing:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7912
	pixelSize:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7913
	size:13
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7914
	encoding:#'iso8859-1'.
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7915
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7916
     Display
7146
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7917
	getFontWithFoundry:'*'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7918
	family:'courier'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7919
	weight:'medium'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7920
	slant:'r'
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7921
	spacing:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7922
	pixelSize:nil
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7923
	size:13
19b4ad17ca3a better error message
Claus Gittinger <cg@exept.de>
parents: 7141
diff changeset
  7924
	encoding:#'iso10646-1'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7925
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  7926
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  7927
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7928
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7929
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7930
heightOf:aString from:index1 to:index2 inFont:aFontId
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7931
    |resultArray|
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7932
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7933
    resultArray := Array new:5.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7934
    self extentsOf:aString from:index1 to:index2 inFont:aFontId into:resultArray.
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7935
    ^ (resultArray at:4) + (resultArray at:5).
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7936
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7937
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7938
      Screen current
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7939
	heightOf:'hello world' from:1 to:10
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7940
	inFont:(Screen current  getFontWithFoundry:'*'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7941
		    family:'courier new'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7942
		    weight:'medium'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7943
		    slant:'r'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7944
		    spacing:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7945
		    pixelSize:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7946
		    size:13
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7947
		    encoding:#'iso10646-1'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7948
	    ).
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7949
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7950
      Screen current
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
  7951
	heightOf:'hello World gggÖÜ' from:1 to:15
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  7952
	inFont:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7953
    "
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7954
!
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  7955
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7956
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7957
    "return a list with all available fonts on this display.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7958
     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
  7959
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7960
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7961
6630
81c3e5842617 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6571
diff changeset
  7962
    |names listOfXftFonts|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7963
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7964
    listOfXFonts isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7965
	names := self getAvailableFontsMatching:'*'.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7966
	names isNil ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7967
	    "no names returned ..."
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7968
	    ^ nil
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7969
	].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7970
	listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7971
	listOfXFonts := FontDescription genericFonts, listOfXFonts.
7119
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7972
    ].
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7973
ecda1d9eb5d6 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7092
diff changeset
  7974
    self supportsXftFonts ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7975
	UserPreferences current useXFontsOnly ifFalse:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7976
	    listOfXftFonts := XftFontDescription listOfAvailableFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7977
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7978
	    UserPreferences current useXftFontsOnly ifTrue:[
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7979
		^ listOfXftFonts
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7980
	    ].
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7981
	    ^ listOfXftFonts , listOfXFonts.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  7982
	].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7983
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7984
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7985
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7986
    "
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7987
     Display flushListOfAvailableFonts.
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7988
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  7989
4020
f4bf2bd8272e draw direction
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
  7990
     Display getAvailableFontsMatching:'*'.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7991
     Display getAvailableFontsMatching:'fixed'.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  7992
     Display fontsInFamily:'fixed' filtering:nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7993
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7994
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7995
    "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
  7996
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7997
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7998
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  7999
pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8000
    "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
  8001
     on this display.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8002
     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
  8003
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8004
    |sizes|
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8005
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8006
    sizes := super pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8007
    (sizes notNil and:[sizes isEmpty or:[sizes includes:0]]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8008
	"special: in X11R5 and above, size 0 means:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8009
	 there are scaled versions in all sizes available"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8010
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8011
	^ #(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
  8012
    ].
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8013
    ^ sizes
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8014
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8015
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  8016
     Display pixelSizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
5224
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8017
    "
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8018
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8019
    "Created: 27.2.1996 / 01:38:15 / cg"
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8020
!
c783e3151cc3 Support pixel-sized fonts
Stefan Vogel <sv@exept.de>
parents: 5194
diff changeset
  8021
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8022
releaseFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8023
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8024
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8025
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8026
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8027
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  8028
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
  8029
     * 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
  8030
     */
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8031
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8032
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8033
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8034
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  8035
    if (__isExternalAddress(aFontId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8036
	f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8037
	if (f) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8038
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8039
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8040
	    XFreeFont(myDpy, f);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8041
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  8042
#ifdef COUNT_RESOURCES
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8043
	    __cnt_font--;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8044
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8045
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8046
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8047
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8048
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8049
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8050
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8051
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8052
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8053
    "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
  8054
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8055
     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
  8056
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8057
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8058
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8059
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8060
    (sizes notNil and:[sizes includes:0]) ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8061
	"special: in X11R5 and above, size 0 means:
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8062
	 there are scaled versions in all sizes available"
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8063
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
  8064
	^ #(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
  8065
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8066
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8067
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8068
    "
6106
6106164b8eec class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6096
diff changeset
  8069
     Display sizesInFamily:'courier' face:'bold' style:'roman' filtering:nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8070
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8071
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  8072
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8073
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8074
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8075
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8076
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8077
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8078
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
  8079
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8080
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8081
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8082
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8083
    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
  8084
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8085
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  8086
    int nInstBytes;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8087
    int directionReturn, fontAscentReturn, fontDescentReturn;
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8088
    XCharStruct overAllReturn;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8089
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8090
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8091
	if (__bothSmallInteger(index1, index2)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8092
	 && __isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8093
	 && __isNonNilObject(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8094
	    int lMax = __intVal(@global(MaxStringLength));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8095
	    f = __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8096
	    if (! f) goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8097
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8098
	    i1 = __intVal(index1) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8099
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8100
	    if (i1 >= 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8101
		OBJ cls;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8102
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8103
		i2 = __intVal(index2) - 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8104
		if (i2 < i1) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8105
		    RETURN ( __MKSMALLINT(0) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8106
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8107
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8108
		cp = (char *) __stringVal(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8109
		l = i2 - i1 + 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8110
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8111
		if (__isStringLike(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8112
		    n = __stringSize(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8113
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8114
			cp += i1;
3482
5c86f1218cfc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  8115
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8116
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8117
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8118
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8119
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8120
			//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
  8121
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8122
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8123
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8124
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8125
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8126
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8127
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8128
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8129
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8130
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8131
		cls = __qClass(aString);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8132
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8133
		cp += nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8134
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8135
		if (__isBytes(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8136
		    n = __byteArraySize(aString) - nInstBytes;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8137
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8138
			cp += i1;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8139
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8140
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8141
			len = XTextExtents(f, cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8142
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8143
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8144
			RETURN ( __MKSMALLINT(overAllReturn.width) );
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8145
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8146
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8147
			len = XTextWidth(f, cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8148
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8149
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8150
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8151
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8152
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8153
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8154
		/* TWOBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8155
		if (__isWords(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8156
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8157
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8158
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8159
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8160
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8161
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8162
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8163
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8164
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8165
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8166
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8167
			cp += (i1 * 2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8168
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8169
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8170
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8171
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8172
			 * X expects them MSB first
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8173
			 * convert as required
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8174
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8175
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8176
			u.s = 0x1234;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8177
			if (u.b[0] != 0x12) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8178
			    if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8179
				cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8180
			    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8181
				cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8182
				mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8183
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8184
			    for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8185
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8186
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8187
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8188
			    cp = (char *) cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8189
			}
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8190
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8191
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8192
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8193
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8194
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8195
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8196
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8197
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8198
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8199
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8200
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8201
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8202
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8203
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8204
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8205
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8206
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8207
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8208
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8209
		/* FOURBYTESTRINGS */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8210
		if (__isLongs(aString)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8211
		    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8212
		    XChar2b *cp2;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8213
		    int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8214
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8215
		    n = (__byteArraySize(aString) - nInstBytes) / 4;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8216
		    if (i2 < n) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8217
			union {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8218
			    char b[2];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8219
			    unsigned short s;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8220
			} u;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8221
			int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8222
			XChar2b *cp2 = (XChar2b *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8223
			int mustFree = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8224
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8225
			cp += (i1 * 4);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8226
			if (l > lMax) l = lMax;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8227
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8228
			/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8229
			 * 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
  8230
			 * 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
  8231
			 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8232
			if (l <= NLOCALBUFFER) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8233
			    cp2 = xlatebuffer;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8234
			} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8235
			    cp2 = (XChar2b *)(malloc(l * 2));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8236
			    mustFree = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8237
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8238
			for (i=0; i<l; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8239
			    int codePoint;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8240
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8241
			    codePoint = ((unsigned int32 *)cp)[i];
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8242
			    if (codePoint > 0xFFFF) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8243
				codePoint = 0xFFFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8244
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8245
			    cp2[i].byte1 = codePoint & 0xFF;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8246
			    cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8247
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8248
			cp = (char *) cp2;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
  8249
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8250
#if 1
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8251
			len = XTextExtents16(f, (XChar2b *)cp, l,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8252
						&directionReturn, &fontAscentReturn, &fontDescentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8253
						&overAllReturn);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8254
			len = overAllReturn.width;
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
  8255
#else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8256
			ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8257
			len = XTextWidth16(f, (XChar2b *)cp, l);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8258
			LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8259
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8260
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8261
			if (mustFree) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8262
			    free(cp2);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8263
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8264
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8265
			RETURN ( __MKSMALLINT(len) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8266
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8267
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8268
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8269
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8270
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  8271
#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
  8272
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  8273
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8274
    self primitiveFailedOrClosedConnection.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  8275
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8276
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8277
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  8278
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8279
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8280
allowEvents:mode
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8281
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8282
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8283
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8284
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8285
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8286
    if (mode == @symbol(asyncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8287
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8288
    else if (mode == @symbol(syncPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8289
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8290
    else if (mode == @symbol(asyncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8291
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8292
    else if (mode == @symbol(syncKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8293
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8294
    else if (mode == @symbol(syncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8295
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8296
    else if (mode == @symbol(asyncBoth))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8297
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8298
    else if (mode == @symbol(replayPointer))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8299
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8300
    else if (mode == @symbol(replayKeyboard))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8301
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8302
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8303
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8304
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8305
    if (ok
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8306
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8307
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8308
	XAllowEvents(myDpy, _mode, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8309
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8310
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8311
	RETURN (self);
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8312
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8313
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8314
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8315
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8316
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8317
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8318
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8319
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8320
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8321
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8322
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8323
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8324
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8325
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8326
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8327
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8328
	    result = XGrabKeyboard(myDpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8329
				   __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8330
				   True /* False */,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8331
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8332
				   GrabModeAsync,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8333
				   CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8334
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8335
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8336
	    ok = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8337
	    switch(result) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8338
		case AlreadyGrabbed:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8339
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8340
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8341
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8342
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8343
		case GrabNotViewable:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8344
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8345
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8346
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8347
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8348
		case GrabInvalidTime:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8349
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8350
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8351
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8352
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8353
		case GrabFrozen:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8354
		    if (@global(ErrorPrinting) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8355
			console_fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8356
		    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8357
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8358
		default:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8359
		    ok = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8360
		    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8361
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8362
	    if (! ok) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8363
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8364
		XUngrabKeyboard(myDpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8365
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8366
		RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8367
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8368
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8369
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8370
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8371
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8372
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8373
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8374
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8375
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8376
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8377
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
  8378
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8379
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8380
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8381
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8382
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8383
    int result, ok;
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8384
    unsigned int evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8385
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8386
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8387
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8388
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8389
    if (ISCONNECTED) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8390
	if (__isExternalAddress(aWindowId)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8391
	    if (__isExternalAddress(confineId))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8392
		confineWin = __WindowVal(confineId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8393
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8394
		confineWin = (Window) None;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8395
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8396
	    if (__isExternalAddress(aCursorId))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8397
		curs = __CursorVal(aCursorId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8398
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8399
		curs = (Cursor) None;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8400
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8401
	    if (pMode == @symbol(sync))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8402
		pointer_mode = GrabModeSync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8403
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8404
		pointer_mode = GrabModeAsync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8405
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8406
	    if (kMode == @symbol(sync))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8407
		keyboard_mode = GrabModeSync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8408
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8409
		keyboard_mode = GrabModeAsync;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8410
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8411
	    if (__isSmallInteger(eventMask))
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8412
		evMask = __intVal(eventMask);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8413
	    else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8414
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8415
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8416
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8417
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8418
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8419
*/
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8420
	    result = XGrabPointer(myDpy,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8421
				  __WindowVal(aWindowId),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8422
				  False,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8423
				  evMask,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8424
				  pointer_mode, keyboard_mode,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8425
				  confineWin,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8426
				  curs,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8427
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8428
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8429
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8430
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8431
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8432
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8433
	    ok = 0;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8434
	    switch (result) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8435
		case AlreadyGrabbed:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8436
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8437
			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
  8438
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8439
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8440
		case GrabNotViewable:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8441
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8442
			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
  8443
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8444
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8445
		case GrabInvalidTime:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8446
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8447
			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
  8448
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8449
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8450
		case GrabFrozen:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8451
		    if (@global(ErrorPrinting) == true) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8452
			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
  8453
		    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8454
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8455
		default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8456
		    ok = 1;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8457
		    break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8458
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8459
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8460
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8461
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8462
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8463
*/
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8464
		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
  8465
/*
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8466
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8467
*/
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8468
		RETURN (false);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8469
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8470
	    RETURN ( true );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8471
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8472
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  8473
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8474
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8475
    ^ false
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8476
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8477
    "Modified: / 17-05-2018 / 18:27:33 / Stefan Vogel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8478
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8479
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8480
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
  8481
    "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
  8482
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8483
    ^ self
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8484
	grabPointerIn:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8485
	withCursor:aCursorId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8486
	eventMask:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8487
	pointerMode:pMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8488
	keyboardMode:kMode
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8489
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8490
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8491
    "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
  8492
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  8493
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8494
primUngrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8495
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8496
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8497
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8498
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8499
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8500
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8501
	Display *dpy = myDpy;
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
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8504
	XUngrabKeyboard(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8505
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8506
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8507
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8508
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8509
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8510
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8511
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8512
primUngrabPointer
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8513
    "release the pointer"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8514
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8515
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8516
%{
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8517
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8518
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8519
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8520
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8521
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8522
	XUngrabPointer(dpy, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8523
	XSync(dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8524
	LEAVE_XLIB();
3225
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8525
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8526
    }
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8527
%}.
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8528
!
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8529
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8530
ungrabKeyboard
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8531
    "release the keyboard"
ea4d18da0983 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  8532
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8533
    activeKeyboardGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8534
	activeKeyboardGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8535
	self primUngrabKeyboard.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  8536
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8537
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8538
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8539
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8540
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8541
3467
66a720085cd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3464
diff changeset
  8542
    activePointerGrab notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8543
	activePointerGrab := nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8544
	self primUngrabPointer.
3453
be18ea6dfbad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3449
diff changeset
  8545
    ]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8546
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8547
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8548
!XWorkstation methodsFor:'grabbing-keys'!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8549
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8550
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
  8551
    "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
  8552
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8553
     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
  8554
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8555
     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
  8556
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8557
     ModeKbd and modePtr are symbols GrabModeAsync or GrabModeSync.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8558
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8559
     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
  8560
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8561
     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
  8562
     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
  8563
     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
  8564
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8565
     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
  8566
     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
  8567
    "
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8568
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8569
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8570
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8571
%{
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8572
    unsigned int modifierMask = AnyModifier;
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8573
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8574
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8575
    if (__isStringLike(keySymCodeOrChar)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8576
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8577
    } else {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8578
	if (__isCharacter(keySymCodeOrChar)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8579
	    char s[2];
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8580
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8581
	    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
  8582
	    s[1] = '\0';
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8583
	    keySym = XStringToKeysym(s);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8584
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8585
	    if (__isSmallInteger(keySymCodeOrChar)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8586
		keySym = (KeySym) __intVal(keySymCodeOrChar);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8587
	    } else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8588
		goto notOK;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8589
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8590
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8591
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8592
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8593
    if (modifierMaskOrNil != nil) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8594
	if (__isSmallInteger(modifierMaskOrNil)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8595
	    modifierMask = __intVal(modifierMaskOrNil);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8596
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8597
	    goto notOK;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8598
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8599
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8600
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8601
    if (ISCONNECTED) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8602
	Display *dpy;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8603
	Window window;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8604
	int keyCode;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8605
	int result;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8606
	int mKbd, mPtr;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8607
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8608
	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
  8609
	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
  8610
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8611
	dpy = myDpy;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8612
	keyCode = XKeysymToKeycode(dpy, keySym);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8613
	if (__isExternalAddress(aWindowIdOrNil)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8614
	    window = __WindowVal(aWindowIdOrNil);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8615
	} else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8616
	    int screen;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8617
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8618
	    screen = DefaultScreen(dpy);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8619
	    window = RootWindow(dpy, screen);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8620
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8621
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8622
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8623
	result = XGrabKey (dpy,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8624
	    keyCode, modifierMask, window,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8625
	    False, mKbd, mPtr );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8626
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8627
	XSync(dpy, True);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8628
	XFlush(dpy);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8629
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8630
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8631
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8632
	if (result != Success) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8633
	    if (result == BadAccess) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8634
		__INST(lastError) = @symbol(badAccess);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8635
	    } else {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8636
		__INST(lastError) = @symbol(other);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8637
	    }
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8638
	    RETURN (false);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8639
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8640
	RETURN (true);
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8641
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8642
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8643
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8644
    self primitiveFailedOrClosedConnection
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8645
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8646
    "Modified: / 03-05-2018 / 16:27:51 / stefan"
8368
03bf464aa8c8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8367
diff changeset
  8647
    "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
  8648
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8649
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8650
grabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8651
    "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
  8652
     or the whole screen (if aWindowIdOrNil is nil).
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8653
     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
  8654
     or a character.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8655
     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
  8656
     if nil, the key is grabbed with AnyModifier.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8657
     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
  8658
     (GrabModeAsync).
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8659
     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
  8660
     the DisplayRootWindow"
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8661
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8662
    ^ self
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8663
	grabKey:keySymCodeOrChar
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8664
	modifier:modifierMaskOrNil
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8665
	grabModeKeyboard:#GrabModeAsync
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8666
	grabModePointer:#GrabModeAsync
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  8667
	window:aWindowIdOrNil
8436
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8668
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8669
    "
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8670
     Display grabKey:#Escape modifier:nil window:nil.
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8671
     Delay waitForSeconds:15.
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8672
     Display ungrabKey:#Escape modifier:nil window:nil.
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8673
    "
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8674
ea264e228c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8416
diff changeset
  8675
    "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
  8676
!
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8677
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8678
ungrabKey:keySymCodeOrChar modifier:modifierMaskOrNil window:aWindowIdOrNil
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8679
    "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
  8680
     Read the comment there."
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8681
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8682
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8683
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8684
%{
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8685
    int modifierMask = AnyModifier;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8686
    KeySym keySym, *syms;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8687
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8688
    if (__isStringLike(keySymCodeOrChar)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8689
	keySym = XStringToKeysym(__stringVal(keySymCodeOrChar));
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8690
    } else {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8691
	if (__isCharacter(keySymCodeOrChar)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8692
	    char s[2];
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8693
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8694
	    s[0] = __intVal(__characterVal(keySymCodeOrChar));
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8695
	    s[1] = '\0';
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8696
	    keySym = XStringToKeysym(s);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8697
	} else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8698
	    if (__isSmallInteger(keySymCodeOrChar)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8699
		keySym = (KeySym) __intVal(keySymCodeOrChar);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8700
	    } else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8701
		goto notOK;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8702
	    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8703
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8704
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8705
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8706
    if (modifierMaskOrNil != nil) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8707
	if (__isSmallInteger(modifierMaskOrNil)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8708
	    modifierMask = __intVal(modifierMaskOrNil);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8709
	} else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8710
	    goto notOK;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8711
	}
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8712
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8713
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8714
    if (ISCONNECTED) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8715
	Display *dpy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8716
	Window window;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8717
	int keyCode;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8718
	int result;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8719
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8720
	dpy = myDpy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8721
	if (__isExternalAddress(aWindowIdOrNil)) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8722
	    window = __WindowVal(aWindowIdOrNil);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8723
	} else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8724
	    int screen;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8725
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8726
	    screen = DefaultScreen(dpy);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8727
	    window = RootWindow(dpy, screen);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8728
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8729
	keyCode = XKeysymToKeycode(dpy, keySym);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8730
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8731
	ENTER_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8732
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8733
	result = XUngrabKey (dpy, keyCode, modifierMask, window);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8734
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8735
	XSync(dpy, True);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8736
	XFlush(dpy);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8737
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8738
	LEAVE_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8739
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8740
	if (result != Success) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8741
	    if (result == BadAccess) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8742
		__INST(lastError) = @symbol(badAccess);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8743
	    } else {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8744
		__INST(lastError) = @symbol(other);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8745
	    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8746
	    RETURN (false);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8747
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
  8748
	RETURN (true);
6570
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8749
    }
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8750
  notOK: ;
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8751
%}.
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8752
    self primitiveFailedOrClosedConnection
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8753
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
  8754
    "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
  8755
! !
6751a32c66ec Removed leftover debug print
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6569
diff changeset
  8756
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8757
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8758
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8759
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8760
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8761
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8762
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8763
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8764
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8765
    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
  8766
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8767
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8768
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8769
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8770
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8771
	    gcv.clip_mask = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8772
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8773
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8774
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8775
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8776
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8777
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8778
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8779
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8780
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8781
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8782
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8783
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8784
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8785
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8786
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8787
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8788
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8789
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8790
	 && __isSmallInteger(bgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8791
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8792
	    XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8793
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8794
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8795
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8796
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8797
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8798
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8799
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8800
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8801
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8802
    "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
  8803
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8804
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8805
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8806
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8807
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8808
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8809
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8810
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8811
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8812
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8813
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8814
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8815
	    if (__isExternalAddress(aBitmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8816
		bitmap = __PixmapVal(aBitmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8817
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8818
		XSetStipple(dpy, gc, bitmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8819
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8820
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8821
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8822
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8823
	    if (aBitmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8824
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8825
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8826
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8827
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8828
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8829
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8830
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8831
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8832
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8833
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8834
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  8835
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8836
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8837
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8838
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8839
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8840
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8841
    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
  8842
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8843
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8844
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8845
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8846
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8847
	    if (aBool == true)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8848
		gcv.subwindow_mode = ClipByChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8849
	    else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8850
		gcv.subwindow_mode = IncludeInferiors;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8851
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8852
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8853
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8854
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8855
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8856
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8857
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8858
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8859
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8860
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8861
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  8862
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
  8863
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8864
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8865
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8866
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8867
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8868
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8869
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8870
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8871
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8872
	 && __bothSmallInteger(clipX, clipY)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8873
	 && __bothSmallInteger(clipWidth, clipHeight)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8874
	    r.x = __intVal(clipX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8875
	    r.y = __intVal(clipY);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8876
	    r.width = __intVal(clipWidth);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8877
	    r.height = __intVal(clipHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8878
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8879
	    XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8880
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8881
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8882
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8883
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8884
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8885
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8886
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8887
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8888
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8889
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8890
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8891
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8892
%{
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8893
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8894
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8895
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8896
	 && __isSmallInteger(offset)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8897
	 && __isByteArrayLike(dashList)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8898
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8899
	    XSetDashes(myDpy, __GCVal(aGCId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8900
		       __intVal(offset),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8901
		       __ByteArrayInstPtr(dashList)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8902
		       __byteArraySize(dashList));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8903
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8904
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8905
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8906
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8907
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8908
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8909
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8910
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8911
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8912
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8913
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8914
    self primitiveFailedOrClosedConnection
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8915
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  8916
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8917
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8918
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8919
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8920
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8921
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8922
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8923
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8924
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8925
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8926
	if (__isExternalAddress(aFontId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8927
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8928
	    f = (XFontStruct *) __FontVal(aFontId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8929
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8930
	    XSetFont(myDpy, __GCVal(aGCId), f->fid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8931
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8932
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8933
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8934
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8935
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8936
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8937
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8938
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8939
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8940
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8941
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8942
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8943
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8944
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8945
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8946
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8947
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8948
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8949
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8950
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8951
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8952
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8953
	 && __isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8954
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8955
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8956
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8957
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8958
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8959
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8960
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8961
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8962
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8963
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8964
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8965
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8966
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8967
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8968
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8969
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8970
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8971
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8972
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8973
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8974
	if (__isExternalAddress(aGCId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8975
	 && __isSmallInteger(fgColorIndex)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8976
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8977
	    XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8978
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8979
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  8980
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8981
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8982
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8983
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8984
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8985
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8986
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8987
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8988
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  8989
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  8990
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8991
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8992
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8993
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8994
	if (__isExternalAddress(aGCId)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8995
	    GC gc = __GCVal(aGCId);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8996
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8997
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8998
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  8999
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9000
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9001
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9002
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9003
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9004
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9005
	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9006
	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9007
	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9008
	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9009
	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9010
	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9011
	    if (fun != -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9012
		ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9013
		XSetFunction(myDpy, gc, fun);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9014
		LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9015
		RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9016
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9017
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9018
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9019
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9020
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9021
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9022
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9023
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9024
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9025
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9026
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9027
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9028
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9029
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9030
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9031
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9032
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9033
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9034
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9035
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9036
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9037
	    XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9038
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9039
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9040
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9041
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9042
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9043
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9044
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9045
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9046
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9047
    "set line attributes;
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9048
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9049
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9050
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9051
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9052
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9053
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9054
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9055
    int x_style, x_cap, x_join;
6768
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9056
    static char dotList[2] = { 1,1 };
e74f22d951a6 ouch - dash- and dotList were swapped.
Claus Gittinger <cg@exept.de>
parents: 6762
diff changeset
  9057
    static char dashList[2]  = { 4,4 };
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9058
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9059
    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
  9060
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  9061
    int x_nDash;
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(aNumber)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9066
	    Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9067
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9068
	    if (lineStyle == @symbol(solid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9069
		x_dashes = (char *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9070
		x_style = LineSolid;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9071
	    } else if (lineStyle == @symbol(dashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9072
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9073
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9074
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9075
	    } else if (lineStyle == @symbol(doubleDashed)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9076
		x_dashes = dashList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9077
		x_nDash = sizeof(dashList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9078
		x_style = LineDoubleDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9079
	    } else if (lineStyle == @symbol(dotted)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9080
		x_dashes = dotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9081
		x_nDash = sizeof(dotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9082
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9083
	    } else if (lineStyle == @symbol(dashDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9084
		x_dashes = dashDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9085
		x_nDash = sizeof(dashDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9086
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9087
	    } else if (lineStyle == @symbol(dashDotDot)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9088
		x_dashes = dashDotDotList;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9089
		x_nDash = sizeof(dashDotDotList);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9090
		x_style = LineOnOffDash;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9091
	    } else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9092
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9093
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9094
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9095
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9096
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9097
	    else goto bad;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9098
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9099
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9100
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9101
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9102
	    else goto bad;
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
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9105
	    if (x_dashes) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9106
		XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9107
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9108
	    XSetLineAttributes(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9109
			       __GCVal(aGCId), __intVal(aNumber),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9110
			       x_style, x_cap, x_join);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9111
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9112
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9113
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9114
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9115
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9116
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9117
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9118
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  9119
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9120
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9121
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9122
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9123
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9124
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9125
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9126
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9127
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9128
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9129
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9130
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9131
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9132
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9133
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9134
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9135
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9136
	    XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9137
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9138
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9139
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9140
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9141
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9142
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9143
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9144
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9145
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9146
    "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
  9147
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9148
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9149
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9150
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  9151
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9152
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9153
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9154
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9155
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9156
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9157
	if (__isExternalAddress(aGCId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9158
	    gc = __GCVal(aGCId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9159
	    if (__isExternalAddress(aPixmapId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9160
		pixmap = __PixmapVal(aPixmapId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9161
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9162
		XSetTile(dpy, gc, pixmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9163
		XSetFillStyle(dpy, gc, FillTiled);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9164
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9165
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9166
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9167
	    if (aPixmapId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9168
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9169
		XSetFillStyle(dpy, gc, FillSolid);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9170
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9171
		RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9172
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9173
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9174
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9175
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9176
    self primitiveFailedOrClosedConnection
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9177
!
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9178
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9179
setPlaneMask:bits in:aGCId
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9180
    "set foreground color to be drawn with"
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9181
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9182
    <context: #return>
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9183
%{
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9184
    if (ISCONNECTED) {
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9185
	if (__isExternalAddress(aGCId)
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9186
	 && __isSmallInteger(bits)) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9187
	    unsigned long mask = __intVal(bits);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9188
	    if (__intVal(bits) == -1) {
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9189
		mask = AllPlanes;
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9190
	    }
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9191
	    ENTER_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9192
	    XSetPlaneMask(myDpy, __GCVal(aGCId), mask);
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9193
	    LEAVE_XLIB();
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9194
	    RETURN ( self );
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9195
	}
7351
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9196
    }
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9197
%}.
f4896612f0de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7348
diff changeset
  9198
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9199
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9200
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
  9201
!XWorkstation methodsFor:'initialization & release'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9202
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9203
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9204
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9205
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9206
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  9207
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9208
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9209
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  9210
3787
58b1a317d361 Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents: 3779
diff changeset
  9211
%{ /* UNLIMITEDSTACK */   /* calls XSync()! */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9212
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9213
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9214
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9215
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9216
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9217
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9218
	XCloseDisplay(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9219
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9220
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9221
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9222
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9223
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9224
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9225
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9226
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9227
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9228
%{
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9229
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9230
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9231
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9232
	__INST(displayId) = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9233
	close(ConnectionNumber(dpy));
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9234
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9235
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9236
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  9237
3216
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9238
eventBufferSize
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9239
%{
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9240
    RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) );
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9241
%}
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9242
!
542b2f1a3e9a rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  9243
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9244
getWindowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9245
    "Creates a fake WindowGroup view. This window is used
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9246
     in XWMHints & _NET_WM_LEADER properties to define
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9247
     application window group"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9248
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9249
    windowGroupWindow isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9250
	windowGroupWindow := WindowGroupWindow new create.
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9251
    ].
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9252
    ^ windowGroupWindow
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9253
!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
  9254
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9255
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  9256
    activateOnClick := false.
6156
dd328de0a324 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6154
diff changeset
  9257
    maxOperationsUntilFlush := nil.
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
  9258
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  9259
    super initializeDefaultValues.
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9260
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9261
    "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
  9262
    Even on 2-button mouse (button 2 is simply not reported).
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9263
    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
  9264
    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
  9265
    is somewhat special value.
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9266
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
  9267
    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
  9268
    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
  9269
7478
4865dd2c05c9 #OTHER by mawalch
mawalch
parents: 7443
diff changeset
  9270
    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
  9271
    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
  9272
    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
  9273
    "
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9274
6092
92572b3d40ea you shalt not modify literal arrays
Claus Gittinger <cg@exept.de>
parents: 6064
diff changeset
  9275
    buttonTranslation := buttonTranslation copy.
5904
238059ebf678 Make paste button symbolic wia translation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5903
diff changeset
  9276
    buttonTranslation at: 2 put: #paste
5903
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9277
1ae08cd914f6 changed: #initializeDefaultValues
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5902
diff changeset
  9278
    "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
  9279
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9280
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9281
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9282
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9283
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  9284
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  9285
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9286
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9287
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9288
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9289
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9290
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9291
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9292
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9293
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9294
     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
  9295
     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
  9296
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9297
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9298
    displayId notNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9299
	"/ already connected - you bad guy try to trick me manually ?
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9300
	^ self
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9301
    ].
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9302
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9303
    displayId := self openConnectionTo:aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9304
    displayId isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9305
	"/ could not connect.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9306
	DeviceOpenErrorSignal raiseWith:aDisplayName.
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9307
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9308
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9309
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9310
    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9311
    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
4409
fdb60a1f78da remember broken connection
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
  9312
    hasConnectionBroken := false.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9313
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9314
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9315
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9316
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9317
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9318
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9319
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9320
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9321
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9322
    buttonsPressed := 0.
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3615
diff changeset
  9323
    displayName := aDisplayName.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9324
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9325
    listOfXFonts := nil.
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9326
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
  9327
    atoms := nil.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9328
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
  9329
    "These values are initialized by primitive code in #createWindowFor:..."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9330
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9331
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9332
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9333
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9334
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9335
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9336
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9337
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9338
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9339
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9340
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  9341
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  9342
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9343
    Screen default isNil ifTrue:[
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9344
	"not initialized yet?"
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
  9345
	self initializeViewStyle.
7313
59b27278b119 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7229
diff changeset
  9346
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9347
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9348
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9349
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9350
    "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
  9351
     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
  9352
     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
  9353
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9354
    |map|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9355
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9356
    super initializeModifierMappings.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9357
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9358
    rawKeySymTranslation := RawKeySymTranslation.
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  9359
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9360
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9361
    map isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9362
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9363
	"/ mhmh - a crippled Xlib which does not provide modifier mappings
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9364
	"/ setup some reasonable default. If that is not sufficient,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9365
	"/ you have to change things from your display.rc file.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9366
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9367
	altModifierMask := self modifier1Mask.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9368
	metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  9369
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9370
	| mod symbolFromKeyCode nonNilOnes |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9371
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9372
	altModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9373
	metaModifierMask := 0.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9374
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9375
	symbolFromKeyCode := [:key | self symbolFromKeycode:key].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9376
	nonNilOnes := [:str | str notNil].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9377
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9378
	mod := map at:1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9379
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9380
	    shiftModifiers := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9381
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9382
	mod := map at:3.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9383
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9384
	    ctrlModifiers  := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9385
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9386
	mod := map at:4.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9387
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9388
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9389
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9390
		metaModifiers := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9391
		metaModifierMask := 1 bitShift:(4-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9392
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9393
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9394
	mod := map at:5.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9395
	mod notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9396
	    mod := mod collect:symbolFromKeyCode thenSelect:nonNilOnes.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9397
	    (mod includes:#'Num_Lock') ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9398
		altModifiers   := mod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9399
		altModifierMask := 1 bitShift:(5-1).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9400
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9401
	]
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9402
    ].
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9403
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  9404
    "
4067
95d3cc7b4f62 getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  9405
     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
  9406
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9407
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9408
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9409
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9410
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9411
initializeScreenBounds
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9412
    self isOpen ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9413
	"queries answer nil if not open"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9414
	^ self.
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9415
    ].
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9416
    self isXineramaActive ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9417
	|rect|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9418
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9419
	self monitorBounds do:[:eachRect|
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9420
	    rect isNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9421
		rect := eachRect.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9422
	    ] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9423
		rect := rect merge:eachRect.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9424
	    ]
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9425
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9426
	width := rect width.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9427
	height := rect height.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9428
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9429
	"propagate possible size changes to our rootView"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9430
	rootView notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9431
	    rootView initialize.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9432
	].
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9433
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9434
	width := self queryWidth.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
  9435
	height := self queryHeight.
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9436
    ].
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9437
    widthMM := self queryWidthMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9438
    heightMM := self queryHeightMM.
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9439
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9440
    "
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9441
      Display initializeScreenBounds
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9442
    "
8313
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9443
0fcbc07d8f35 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8266
diff changeset
  9444
    "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
  9445
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
  9446
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9447
initializeScreenProperties
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9448
    |masks|
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9449
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9450
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9451
7591
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9452
    hasShapeExtension := self hasExtension:#SHAPE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9453
    hasShmExtension := self hasExtension:#MIT_SHM.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9454
    hasDPSExtension := self hasExtension:#DPS.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9455
    hasXVideoExtension := self hasExtension:#XVideo.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9456
    hasMbufExtension := self hasExtension:#'Multi-Buffering'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9457
    hasPEXExtension := self hasExtension:#'X3D-PEX'.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9458
    hasImageExtension := self hasExtension:#XIE.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9459
    hasInputExtension := self hasExtension:#XInputExtension.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9460
    hasXineramaExtension := self hasExtension:#XINERAMA.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9461
    hasRenderExtension := self hasExtension:#RENDER.
bce664b396f0 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 7509
diff changeset
  9462
    hasXftLibrary := hasRenderExtension and:[self class hasXftLibrary].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9463
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9464
    primaryAtom := self atomIDOf:#PRIMARY.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
  9465
    stringAtom := self atomIDOf:#STRING.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
  9466
    clipboardAtom := self atomIDOf:#CLIPBOARD.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9467
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9468
    altModifierMask := self modifier2Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9469
    metaModifierMask := self modifier1Mask.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9470
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9471
    screen := self queryDefaultScreen.
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9472
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9473
    self initializeScreenBounds.
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9474
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9475
    depth := self queryDepth.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9476
    ncells := self queryCells.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9477
    blackpixel := self queryBlackPixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9478
    whitepixel := self queryWhitePixel.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9479
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9480
    monitorType := #unknown.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9481
    visualType := self queryDefaultVisualType.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9482
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9483
    hasColors := hasGreyscales := true.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9484
    (visualType == #StaticGray
5890
9bfc1df32428 added: #initializeScreenBounds
Stefan Vogel <sv@exept.de>
parents: 5886
diff changeset
  9485
     or:[ visualType == #GrayScale]) ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9486
	hasColors := false.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9487
	monitorType := #monochrome.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9488
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9489
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9490
    ncells == 2 ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9491
	hasColors := hasGreyscales := false.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9492
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9493
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9494
    masks := self queryRGBMasks.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9495
    redMask := masks at:1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9496
    greenMask := masks at:2.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9497
    blueMask := masks at:3.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9498
    bitsPerRGB := masks at:4.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9499
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9500
    visualType == #TrueColor ifTrue:[
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9501
	redShift := redMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9502
	greenShift := greenMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9503
	blueShift := blueMask lowBit - 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9504
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9505
	bitsRed := redMask highBit - redMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9506
	bitsGreen := greenMask highBit - greenMask lowBit + 1.
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9507
	bitsBlue := blueMask highBit - blueMask lowBit + 1.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9508
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9509
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  9510
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9511
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9512
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9513
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9514
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9515
    XVisualInfo viproto;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9516
    XVisualInfo *vip;                   /* returned info */
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9517
    int maxRGBDepth, maxRGBADepth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9518
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
6131
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9519
    int rgbaRedMask, rgbaGreenMask, rgbaBlueMask, rgbaAlphaMask;
3d27be935360 rgba query
Claus Gittinger <cg@exept.de>
parents: 6106
diff changeset
  9520
    int rgbVisualID, rgbaVisualID;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9521
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9522
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9523
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9524
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9525
    if (ISCONNECTED) {
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9526
	dpy = myDpy;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9527
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9528
	/*
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9529
	 * look for RGB visual with the highest depth
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9530
	 */
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9531
	nvi = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9532
	viproto.screen = scr;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9533
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9534
	maxRGBDepth = maxRGBADepth = 0;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9535
	for (i = 0; i < nvi; i++) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9536
	    int thisDepth = vip[i].depth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9537
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9538
	    switch (vip[i].class) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9539
		case TrueColor:
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9540
		    if (thisDepth > maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9541
			if (thisDepth <= 24) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9542
			    maxRGBDepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9543
			    rgbRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9544
			    rgbGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9545
			    rgbBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9546
			    rgbVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9547
			} else {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9548
			    if (thisDepth > maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9549
				// printf("found rgba visual!\n");
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9550
				maxRGBADepth = thisDepth;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9551
				rgbaRedMask = vip[i].red_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9552
				rgbaGreenMask = vip[i].green_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9553
				rgbaBlueMask = vip[i].blue_mask;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9554
				rgbaVisualID = vip[i].visualid;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9555
			    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9556
			}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9557
		    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9558
		    break;
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9559
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9560
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9561
	if (vip) XFree ((char *) vip);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9562
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9563
	if (maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9564
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9565
	}
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9566
	if (maxRGBADepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9567
	    __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9568
	    if (!maxRGBDepth) {
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9569
		__INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9570
	    }
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
  9571
	}
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9572
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  9573
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9574
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9575
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9576
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9577
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9578
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9579
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9580
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9581
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9582
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9583
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9584
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9585
    (self serverVendor = 'X11/NeWS') ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9586
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9587
	"/ 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
  9588
	"/ which does not correctly handle saveUnder
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9589
	"/
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9590
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9591
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9592
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9593
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9594
initializeUniqueID
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9595
    uniqueDeviceID isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9596
	uniqueDeviceID := UUID genUUID.
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9597
    ]
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9598
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9599
6261
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9600
invalidateConnection
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9601
    super invalidateConnection.
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9602
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9603
    "the new display may support a different set of fonts"
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9604
    self flushListOfAvailableFonts
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9605
!
e5d7fb9ba201 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  9606
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9607
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9608
    "open a connection to some display;
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
  9609
     return the displayId if ok, nil of not ok"
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9610
3800
558328d5675b More Stack for openDisplay
Stefan Vogel <sv@exept.de>
parents: 3799
diff changeset
  9611
%{ /* STACK:100000 */    /* XOpenDisplay() calls gethostbyname() */
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9612
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9613
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9614
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9615
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  9616
    if (__isStringLike(dpyName))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9617
	nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9618
    else {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9619
	nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9620
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9621
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9622
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9623
    if (dpy) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9624
	static int firstCall = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9625
	OBJ dpyID;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9626
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9627
	dpyID = __MKEXTERNALADDRESS(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9628
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9629
	if (firstCall) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9630
	    firstCall = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9631
	    XSetErrorHandler(__XErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9632
	    XSetIOErrorHandler(__XIOErrorHandler__);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9633
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9634
	RETURN (dpyID);
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9635
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9636
%}.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
  9637
    ^ nil
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9638
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  9639
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9640
queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9641
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9642
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9643
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9644
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9645
	int scr;
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
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9648
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9649
	RETURN ( __MKSMALLINT(BlackPixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9650
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9651
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9652
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9653
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9654
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9655
     Display queryBlackPixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9656
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9657
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9658
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9659
queryCells
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9660
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9661
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9662
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9663
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9664
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9665
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9666
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9667
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9668
	RETURN ( __MKSMALLINT(DisplayCells(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9669
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9670
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9671
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9672
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9673
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9674
     Display queryCells
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9675
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9676
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9677
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9678
queryDefaultScreen
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9679
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9680
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9681
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9682
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9683
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9684
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9685
	RETURN ( __MKSMALLINT(DefaultScreen(dpy)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9686
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9687
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9688
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9689
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9690
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9691
     Display queryDefaultScreen
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9692
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9693
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9694
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9695
queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9696
%{  /* NOCONTEXT */
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9697
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9698
    if (ISCONNECTED) {
6762
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9699
	Display *dpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9700
	Visual *visual;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9701
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9702
	dpy = myDpy;
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9703
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
8d0545bed2f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6758
diff changeset
  9704
	RETURN ( __MKEXTERNALADDRESS( visual ) );
6571
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9705
    }
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9706
%}.
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9707
    ^ nil
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9708
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9709
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9710
     Display queryDefaultVisual
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9711
    "
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9712
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9713
    "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
  9714
!
ad1e51bf2c3b Added queryDefaultVisual which returns value of DefaultVisual().
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6570
diff changeset
  9715
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9716
queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9717
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9718
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9719
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9720
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9721
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9722
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9723
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9724
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9725
	switch (visual->class) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9726
	    case StaticGray:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9727
		RETURN ( @symbol(StaticGray) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9728
	    case GrayScale:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9729
		RETURN ( @symbol(GrayScale) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9730
	    case StaticColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9731
		RETURN ( @symbol(StaticColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9732
	    case PseudoColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9733
		RETURN ( @symbol(PseudoColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9734
	    case TrueColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9735
		RETURN ( @symbol(TrueColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9736
	    case DirectColor:
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9737
		RETURN ( @symbol(DirectColor) );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9738
	}
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9739
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9740
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9741
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9742
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9743
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9744
     Display queryDefaultVisualType
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9745
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9746
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9747
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9748
queryDepth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9749
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9750
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9751
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9752
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9753
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9754
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9755
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9756
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9757
	RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9758
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9759
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9760
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9761
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9762
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9763
     Display queryDepth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9764
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9765
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9766
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9767
queryHeight
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9768
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9769
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9770
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9771
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9772
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9773
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9774
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9775
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9776
	RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9777
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9778
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9779
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9780
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9781
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9782
     Display queryHeight
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9783
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9784
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9785
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9786
queryHeightMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9787
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9788
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9789
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9790
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9791
	int scr;
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9792
	int h;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9793
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9794
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9795
	scr = DefaultScreen(dpy);
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9796
	h = DisplayHeightMM(dpy, scr);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9797
	if (h == 0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9798
	    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
  9799
	    h = 250;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9800
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9801
	RETURN ( __MKSMALLINT(h));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9802
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9803
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9804
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9805
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9806
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9807
     Display queryHeightMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9808
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9809
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9810
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9811
queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9812
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9813
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9814
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9815
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9816
	Visual *visual;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9817
	OBJ redMask, greenMask, blueMask, bprgb;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9818
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9819
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9820
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9821
	redMask   = __MKSMALLINT(visual->red_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9822
	greenMask = __MKSMALLINT(visual->green_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9823
	blueMask  = __MKSMALLINT(visual->blue_mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9824
	bprgb  = __MKSMALLINT(visual->bits_per_rgb);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9825
	RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) );
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9826
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9827
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9828
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9829
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9830
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9831
     Display queryRGBMasks
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9832
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9833
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9834
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9835
queryWhitePixel
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9836
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9837
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9838
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9839
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9840
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9841
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9842
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9843
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9844
	RETURN ( __MKSMALLINT(WhitePixel(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9845
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9846
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9847
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9848
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9849
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9850
     Display queryWhitePixel
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9851
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9852
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9853
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9854
queryWidth
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9855
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9856
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9857
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9858
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9859
	int scr;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9860
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9861
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9862
	scr = DefaultScreen(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9863
	RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr)));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9864
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9865
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9866
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9867
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9868
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9869
     Display queryWidth
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9870
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9871
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9872
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9873
queryWidthMM
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9874
%{  /* NOCONTEXT */
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9875
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9876
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9877
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9878
	int scr;
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9879
	int w;
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9880
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9881
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9882
	scr = DefaultScreen(dpy);
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9883
	w = DisplayWidthMM(dpy, scr);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9884
	if (w == 0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9885
	    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
  9886
	    w = 250;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9887
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
  9888
	RETURN ( __MKSMALLINT(w));
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9889
    }
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9890
%}.
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9891
    ^ nil
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9892
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9893
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
  9894
     Display queryWidthMM
3487
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9895
    "
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9896
!
5f28d7335961 category change
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  9897
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9898
reinitialize
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9899
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9900
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9901
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9902
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9903
    virtualRootId := rootId := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9904
    selectionFetchers := nil.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9905
    dispatchingExpose := nil
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9906
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9907
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9908
releaseDeviceResources
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9909
    preWaitAction notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9910
	Processor removePreWaitAction:preWaitAction.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9911
	preWaitAction := nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9912
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9913
    selectionFetchers := nil.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
  9914
    super releaseDeviceResources.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9915
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9916
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9917
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9918
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9919
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9920
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9921
     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
  9922
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9923
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9924
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9925
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9926
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9927
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9928
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9929
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9930
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9931
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9932
     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
  9933
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9934
     and the setting can be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9935
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9936
     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
  9937
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9938
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9939
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9940
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9941
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9942
appleAltModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9943
    "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
  9944
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9945
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9946
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  9947
	^ 8192
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9948
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9949
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9950
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9951
    "Created: / 10-02-2017 / 21:32:13 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9952
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9953
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9954
appleCmdModifierMask
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9955
    "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
  9956
     Nil returned for other displays"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9957
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9958
    OperatingSystem isOSXlike ifTrue:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
  9959
	^ 16
7864
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9960
    ].
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9961
    ^ nil
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9962
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9963
    "Created: / 10-02-2017 / 21:32:50 / cg"
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9964
!
378dff46eb90 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7780
diff changeset
  9965
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9966
ctrlModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9967
    "return the Xlib mask bit for the control modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9968
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9969
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9970
    RETURN (__MKSMALLINT(ControlMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9971
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9972
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
  9973
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9974
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9975
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9976
     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
  9977
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9978
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9979
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9980
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9981
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9982
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9983
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  9984
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9985
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9986
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9987
     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
  9988
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9989
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9990
     be changed with:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
  9991
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9992
     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
  9993
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9994
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9995
     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
  9996
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9997
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9998
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  9999
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10000
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10001
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10002
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10003
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10004
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10005
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10006
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10007
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10008
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10009
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10010
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10011
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10012
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10013
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10014
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10015
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10016
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10017
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10018
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10019
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10020
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10021
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10022
modifier3Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10023
    "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
 10024
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10025
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10026
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10027
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10028
    RETURN (__MKSMALLINT(Mod3Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10029
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10030
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10031
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10032
modifier4Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10033
    "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
 10034
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10035
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10036
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10037
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10038
    RETURN (__MKSMALLINT(Mod4Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10039
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10040
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10041
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10042
modifier5Mask
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10043
    "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
 10044
     See comment in altModifierMask: / metaModifierMask: for what
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10045
     this could be used."
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10046
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10047
%{  /* NOCONTEXT */
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10048
    RETURN (__MKSMALLINT(Mod5Mask));
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10049
%}
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10050
!
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10051
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10052
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10053
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10054
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10055
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10056
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10057
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10058
    modifierKeyMap := self rawModifierMapping.
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
 10059
    modifierKeyMap isEmptyOrNil ifTrue:[^ nil].
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10060
    maxKeyPerMod := modifierKeyMap size // 8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10061
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10062
    ret := Array new:8.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10063
    nextKey := 1.
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10064
    1 to:8 do:[ :i |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10065
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10066
	    |mod|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10067
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10068
	    mod := OrderedCollection new:maxKeyPerMod.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10069
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10070
		key ~= 0 ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10071
		    mod add:key
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10072
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10073
	    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10074
	    ret at:i put:mod asArray.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10075
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10076
	nextKey := nextKey+maxKeyPerMod.
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10077
    ].
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10078
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10079
    ^ ret
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10080
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10081
    "
3305
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10082
     Display modifierMapping
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10083
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10084
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10085
    "
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10086
     |mapping|
05abfe559bb6 preps for super-key support
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
 10087
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10088
     mapping := Display modifierMapping.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10089
     ^ mapping collect:[:eachRow |
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10090
			     eachRow notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10091
				 eachRow collect:[ :key | Display stringFromKeycode:key ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10092
			     ] ifFalse:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10093
				 nil
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
		       ].
3322
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10096
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10097
!
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10098
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10099
rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10100
    "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
 10101
     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
 10102
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10103
    ^ rawKeySymTranslation
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10104
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10105
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10106
    "
1c92a842f099 keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
 10107
     Display rawKeySymTranslation
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10108
    "
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10109
!
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10110
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10111
rawModifierMapping
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10112
    "Get the raw Modifier Mapping."
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10113
5586
1c02d95a3e80 changed:
Stefan Vogel <sv@exept.de>
parents: 5568
diff changeset
 10114
    |modifierKeyMap|
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10115
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10116
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10117
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10118
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10119
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10120
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10121
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10122
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10123
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10124
	   if (modifierKeyMap != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10125
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10126
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10127
	   }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10128
	   XFreeModifiermap(modmap);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10129
	}
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10130
    }
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10131
%}.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10132
    ^ modifierKeyMap
3214
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10133
359316f51b9f rel5 migration
Claus Gittinger <cg@exept.de>
parents: 3207
diff changeset
 10134
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10135
	Display rawModifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10136
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10137
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10138
3230
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10139
shiftModifierMask
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10140
    "return the Xlib mask bit for the shift modifier key"
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10141
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10142
%{  /* NOCONTEXT */
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10143
    RETURN (__MKSMALLINT(ShiftMask));
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10144
%}
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10145
!
e6e06f7b7df4 new event decomposition code.
Claus Gittinger <cg@exept.de>
parents: 3229
diff changeset
 10146
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10147
superModifierMask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10148
    "return the Xlib mask bit for the super modifier key"
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10149
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10150
    ^ self modifier4Mask
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10151
!
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10152
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10153
symbolFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10154
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10155
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10156
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10157
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10158
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10159
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10160
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10161
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10162
    if (ISCONNECTED && __isSmallInteger(code)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10163
	Display *dpy = myDpy;
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10164
5983
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10165
// Our Windows Xlib does not support Xkb as of 2013-01
d7740b5eb6b4 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5982
diff changeset
 10166
//        if ((keysym = XkbKeycodeToKeysym(dpy, __intVal(code), 0, 0)) != NoSymbol
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10167
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10168
	    && (keystring = XKeysymToString(keysym)) != 0)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10169
	    str = __MKSYMBOL(keystring, 0);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10170
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10171
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10172
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10173
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10174
    "
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10175
	Display symbolFromKeycode:50
5982
590849deb045 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5979
diff changeset
 10176
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10177
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10178
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10179
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10180
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10181
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10182
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10183
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10184
    UserPreferences current beepEnabled ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10185
	self beep:0 volume:50.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10186
	self flush
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
 10187
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10188
6758
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10189
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10190
     Screen current beep
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10191
    "
68c8fc0ab607 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6630
diff changeset
 10192
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
 10193
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10194
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10195
5247
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10196
beep:aSymbolOrInteger volume:volumeInPercent
01a7136e6d33 Rename beep: to beep:volume: for compatibility with WinWorkstation
Stefan Vogel <sv@exept.de>
parents: 5234
diff changeset
 10197
    "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
 10198
     (kept for comaptibilty with WinWorkstation)."
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10199
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10200
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10201
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10202
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10203
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10204
    if (__isSmallInteger(volumeInPercent)
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10205
     && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10206
	/* stupid: X wants -100 .. 100 and calls this percent */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10207
	volume = __intVal(volumeInPercent) * 2 - 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10208
	if (volume < -100) volume = -100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10209
	else if (volume > 100) volume = 100;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10210
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10211
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10212
	XBell(myDpy, volume);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10213
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10214
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10215
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10216
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10217
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10218
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10219
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10220
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10221
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10222
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10223
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10224
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10225
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10226
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10227
	XSynchronize(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10228
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10229
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10230
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10231
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10232
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10233
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10234
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10235
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10236
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10237
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10238
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10239
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10240
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10241
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10242
     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
 10243
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10244
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10245
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10246
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10247
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10248
	XFlush(myDpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10249
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10250
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10251
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10252
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10253
    operationsUntilFlush := maxOperationsUntilFlush.
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10254
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
 10255
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10256
flushDpsContext:aDPSContext
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10257
    <context: #return>
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10258
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10259
#ifdef DPS
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10260
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10261
	&& __isExternalAddress(aDPSContext)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10262
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10263
	DPSFlushContext(__DPSContextVal(aDPSContext));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10264
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10265
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10266
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10267
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10268
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10269
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10270
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10271
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10272
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10273
flushIfAppropriate
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10274
    "flush the device, if necessary"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10275
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10276
    operationsUntilFlush notNil ifTrue:[
6350
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10277
	operationsUntilFlush <= 0 ifTrue:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10278
	    self flush.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10279
	    ^ true.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10280
	] ifFalse:[
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10281
	    operationsUntilFlush := operationsUntilFlush - 1.
e15b6facdf7c class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6335
diff changeset
 10282
	].
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10283
    ].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10284
    ^ false.
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10285
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 10286
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10287
primSync
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10288
    "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
 10289
     has finished drawing it.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10290
     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
 10291
     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
 10292
     to be finished. See also #flush."
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10293
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10294
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10295
%{
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10296
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10297
    if (ISCONNECTED) {
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10298
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10299
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10300
	XSync(myDpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10301
	LEAVE_XLIB();
6152
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10302
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10303
    }
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10304
%}.
1933a8c5de56 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6131
diff changeset
 10305
    operationsUntilFlush := maxOperationsUntilFlush.
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10306
!
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10307
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10308
refreshKeyboardMapping:eB
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10309
    <context: #return>
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10310
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10311
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10312
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 10313
    if (ISCONNECTED && __isByteArrayLike(eB)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10314
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10315
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10316
	XRefreshKeyboardMapping(ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10317
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10318
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10319
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10320
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10321
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10322
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10323
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10324
roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10325
    "answer the round trip time in milliSeconds.
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10326
     May be used to detect slow X11 connections"
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10327
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10328
    self sync.
4119
a770b7e08c72 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 4114
diff changeset
 10329
    ^ Timestamp millisecondsToRun:[ self primSync ].
3575
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10330
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10331
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10332
     Screen current roundTripTime
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10333
    "
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10334
!
7de8c94fc7fa New method: #roundTripTime
Stefan Vogel <sv@exept.de>
parents: 3537
diff changeset
 10335
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10336
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10337
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10338
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
 10339
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10340
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10341
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10342
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10343
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10344
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10345
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10346
     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
 10347
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10348
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10349
     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
 10350
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10351
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10352
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10353
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10354
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10355
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10356
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10357
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10358
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10359
	    focusWindow = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10360
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10361
	    focusWindow = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10362
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10363
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10364
	if (revertSymbol == @symbol(parent))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10365
	    arg = RevertToParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10366
	else if (revertSymbol == @symbol(root))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10367
	    arg = RevertToPointerRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10368
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10369
	    arg = RevertToNone;
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
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10372
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10373
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10374
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10375
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10376
	RETURN ( self );
3650
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10377
    }
801f98670917 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 3647
diff changeset
 10378
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10379
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10380
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10381
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10382
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10383
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10384
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10385
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10386
     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
 10387
     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
 10388
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
 10389
3326
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10390
    self primSync.
5d58d51bf927 sync checks for pending events
Claus Gittinger <cg@exept.de>
parents: 3322
diff changeset
 10391
    self dispatchPendingEvents.
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10394
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10395
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10396
     This makes all graphics synchronous and turns off any buffering
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10397
     (i.e. each individual draw-request is sent immediately without
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10398
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10399
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10400
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
 10401
     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
 10402
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10403
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10404
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10405
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10406
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10407
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10408
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10409
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10410
	XSynchronize(myDpy, 1);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10411
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10412
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10413
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10414
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10415
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10416
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
 10417
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10418
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10419
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10420
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10421
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10422
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10423
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10424
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10425
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10426
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10427
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10428
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10429
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10430
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10431
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10432
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10433
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10434
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10435
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10436
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10437
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10438
     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
 10439
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10440
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10441
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10442
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10443
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10444
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10445
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10446
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10447
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10448
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10449
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10450
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10451
	w = RootWindow(dpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10452
	if (w) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10453
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10454
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10455
	    XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10456
				 &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10457
				 &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10458
				 &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10459
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10460
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10461
	    RETURN (__MKSMALLINT(mask));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10462
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10463
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10464
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10465
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10466
    ^ nil
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10467
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10468
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10469
     Display buttonStates
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10470
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10471
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10472
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10473
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10474
     Display buttonStates bitTest:(Display controlMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10475
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10476
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10477
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10478
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10479
     Display buttonStates bitTest:(Display altModifierMask)
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 10480
     Display buttonStates bitTest:(Display metaModifierMask)
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10481
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10482
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10483
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10484
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10485
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10486
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10487
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10488
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10489
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10490
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10491
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10492
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10493
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10494
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10495
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10496
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10497
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10498
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10499
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10500
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10501
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10502
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10503
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10504
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10505
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10506
pointerPosition
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10507
    "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
 10508
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10509
    <context: #return>
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10510
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10511
    |xpos ypos rootWindowId|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10512
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10513
    rootWindowId := self rootWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10514
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10515
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
 10516
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10517
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10518
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10519
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10520
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 10521
    if (ISCONNECTED && rootWindowId != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10522
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10523
	Window w = (Window)__externalAddressVal(rootWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10524
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10525
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10526
	XQueryPointer(dpy, w, &rootRet, &childRet,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10527
			      &rootX, &rootY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10528
			      &winX, &winY,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10529
			      &mask);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10530
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10531
	xpos = __MKSMALLINT(rootX);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10532
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 10533
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10534
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10535
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10536
    xpos isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10537
	self primitiveFailedOrClosedConnection.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10538
	^ nil
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10539
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10540
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10541
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10542
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10543
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10544
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10545
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10546
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10547
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10548
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10549
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10550
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
 10551
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10552
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10553
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10554
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10555
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10556
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10557
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10558
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10559
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10560
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10561
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10562
    "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
 10563
     given windows origin (which may be the rootWindow).
3329
05ac7164c99d Fix mouseWheel stuff.
Stefan Vogel <sv@exept.de>
parents: 3326
diff changeset
 10564
     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
 10565
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10566
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10567
     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
 10568
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10569
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10570
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10571
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10572
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10573
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10574
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10575
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10576
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10577
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10578
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10579
     && __bothSmallInteger(xpos, ypos)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10580
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10581
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10582
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10583
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10584
	XWarpPointer(dpy,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10585
		     None,  /* src window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10586
		     w,  /* dst window */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10587
		     0,  /* src_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10588
		     0,  /* src_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10589
		     0,  /* src_w */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10590
		     0,  /* src_h */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10591
		     __intVal(xpos),  /* dst_x */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10592
		     __intVal(ypos)   /* dst_y */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10593
		    );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10594
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10595
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10596
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10597
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10598
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10599
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10600
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
 10601
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10602
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10603
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10604
!XWorkstation methodsFor:'private'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10605
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10606
addSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10607
    "register someone to be notified when the selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10608
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10609
    selectionHandlers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10610
	selectionHandlers := IdentitySet new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10611
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10612
    selectionHandlers add:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10613
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10614
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10615
findSelectionFetcher:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10616
    "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
 10617
     Answer nil, if there is none"
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10618
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10619
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10620
	^ nil.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10621
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10622
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10623
    ^ selectionFetchers at:aDrawableId ifAbsent:[].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10624
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10625
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10626
registerSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10627
    "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
 10628
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10629
    selectionFetchers isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10630
	selectionFetchers := Dictionary new.
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10631
    ].
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10632
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10633
    selectionFetchers at:aSelectionFetcher drawableID put:aSelectionFetcher.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10634
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10635
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10636
removeSelectionHandler:someone
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10637
    "no longer tell someone about selection changes"
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10638
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10639
    selectionHandlers notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10640
	selectionHandlers remove:someone ifAbsent:nil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10641
	selectionHandlers := selectionHandlers asNilIfEmpty
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 10642
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10643
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10644
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10645
unregisterSelectionFetcher:aSelectionFetcher
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10646
    "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
 10647
8053
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10648
    selectionFetchers removeKey:(aSelectionFetcher drawableID) ifAbsent:[].
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10649
80e5562b3bec #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 8024
diff changeset
 10650
    "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
 10651
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10652
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10653
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10654
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10655
deleteProperty:propertyID for:aWindowID
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10656
    "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
 10657
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10658
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10659
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10660
%{
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10661
    if (ISCONNECTED && __isAtomID(propertyID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10662
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10663
	Atom prop;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10664
	Window window;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10665
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10666
	prop = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10667
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10668
	if (__isExternalAddress(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10669
	    window = __WindowVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10670
	} else if (aWindowID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10671
	    window = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10672
	} else if (__isInteger(aWindowID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10673
	    window = (Window)__unsignedLongIntVal(aWindowID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10674
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10675
	    goto fail;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10676
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10677
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10678
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10679
	XDeleteProperty(dpy, window, prop);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10680
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 10681
	RETURN(true);
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10682
    }
3798
17ceda3c711f Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents: 3797
diff changeset
 10683
fail:;
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10684
%}.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10685
    self primitiveFailedOrClosedConnection.
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10686
!
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 10687
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10688
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10689
    "get a property as an association propertyType->propertyValue"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10690
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10691
    |val propertyAtomID association windowIDOrNil|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10692
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10693
    propertySymbolOrAtomID isString ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10694
	propertyAtomID := self atomIDOf:propertySymbolOrAtomID create:false.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10695
	propertyAtomID isNil ifTrue:[^ nil].
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 10696
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10697
	propertyAtomID := propertySymbolOrAtomID.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10698
    ].
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10699
    aWindowOrWindowIDOrNil isView ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10700
	windowIDOrNil := aWindowOrWindowIDOrNil drawableId.
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10701
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10702
	windowIDOrNil := aWindowOrWindowIDOrNil.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10703
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10704
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10705
    association := self primGetProperty:propertyAtomID from:windowIDOrNil delete:doDelete.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10706
    association isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10707
	"The property does not exist in the specified window"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10708
	^ nil
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10709
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10710
    val := association value.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10711
    (val isByteArray and:[association key = (self atomIDOf:#'UTF8_STRING' create:true)]) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10712
	val := val utf8Decoded.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10713
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10714
    (val isString and:[val includes:(Character codePoint:0)]) ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10715
	val := val asCollectionOfSubCollectionsSeparatedBy:(Character codePoint:0).
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10716
    ].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10717
    association value:val.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10718
    ^ association
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10719
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10720
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10721
     Display
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10722
	getProperty:#'_NET_DESKTOP_NAMES'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10723
	from:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10724
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10725
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10726
     Display
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10727
	getProperty:#'_NET_CURRENT_DESKTOP'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10728
	from:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10729
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10730
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10731
     Display
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10732
	getProperty:#'_NET_WM_ALLOWED_ACTIONS'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10733
	from:Transcript
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10734
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10735
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10736
     Display
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10737
	getProperty:#'_NET_SUPPORTED'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10738
	from:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10739
	delete:false
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10740
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10741
     Transcript showCR:(
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10742
	 (Display
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10743
	    getProperty:#'_NET_SUPPORTED'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10744
	    from:nil
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10745
	    delete:false) value
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10746
		    collect:[:eachID | Display atomName:eachID])
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10747
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10748
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10749
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10750
    "Modified: / 31-08-2017 / 22:01:44 / cg"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10751
    "Modified: / 26-04-2018 / 10:58:21 / stefan"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10752
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10753
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10754
primGetProperty:propertyAtomID from:aWindowIDOrNil delete:doDelete
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10755
    "get a property as an association propertyType->propertyValue"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10756
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10757
    <context: #return>
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10758
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10759
    |val typeID|
8341
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 10760
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 10761
%{  /* UNLIMITEDSTACK */
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 10762
// #define PROPERTY_DEBUG
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10763
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10764
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10765
    Atom actual_type;
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 10766
    int actual_format;
8341
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 10767
    unsigned long nread = 0, bytes_after;
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 10768
    char *cp = 0, *cp2;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10769
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10770
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10771
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10772
    if (ISCONNECTED) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10773
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10774
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10775
	if (__isAtomID(propertyAtomID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10776
	    property = __AtomVal(propertyAtomID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10777
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10778
	    if (__isExternalAddress(aWindowIDOrNil)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10779
		window = __WindowVal(aWindowIDOrNil);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10780
	    } else if (aWindowIDOrNil == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10781
		window = DefaultRootWindow(dpy);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10782
	    } else
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10783
		goto fail;
8341
4ff8b5be757e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
 10784
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10785
#ifdef PROPERTY_DEBUG
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10786
	    console_fprintf(stderr, "getProperty %x\n", property);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10787
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10788
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10789
	    do {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10790
		int retVal;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10791
		unsigned char *data;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10792
		unsigned long nitems, nReturnedBytes;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10793
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10794
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10795
		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10796
					    doDelete == true,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10797
					    AnyPropertyType, &actual_type, &actual_format,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10798
					    &nitems, &bytes_after, (unsigned char **)&data);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10799
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10800
		if (retVal != Success) {
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10801
#ifdef PROPERTY_DEBUG
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10802
		    console_fprintf(stderr, "- no success\n");
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10803
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10804
		    ok = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10805
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10806
		}
3974
ed85b0aed5a8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3948
diff changeset
 10807
#ifdef PROPERTY_DEBUG
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10808
		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
 10809
#endif
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10810
		if (actual_type == None) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10811
		    // The property does not exist in the specified window
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10812
		    ok = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10813
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10814
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10815
		typeID = __MKATOMOBJ(actual_type);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10816
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10817
		nReturnedBytes = nitems * (actual_format == 32 ? sizeof(long) : actual_format / 8);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10818
		if (! cp) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10819
		    cp = cp2 = (char *)malloc(nReturnedBytes+bytes_after);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10820
		    if (! cp) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10821
			XFree(data);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10822
			goto fail;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10823
		    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10824
		} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10825
		    cp2 = cp + nread;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10826
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10827
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10828
		nread += nReturnedBytes;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10829
		memcpy(cp2, data, nReturnedBytes);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10830
		XFree(data);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10831
	    } while (bytes_after > 0);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10832
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10833
	    if (ok) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10834
		switch (actual_format) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10835
		case 32:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10836
		    // bad design: even though it says "32",
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10837
		    // what is really returned are longs.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10838
		    // this does make a difference on 64bit machines!
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10839
		    val = __stArrayFromCULongArray((unsigned long*)cp, nread/sizeof(long));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10840
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10841
		case 16:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10842
		    val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10843
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10844
		case 8:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10845
		default:
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10846
		    if (actual_type == XA_STRING) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10847
			val = __MKSTRING_L(cp, nread);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10848
		    } else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10849
			val = __MKBYTEARRAY(cp, nread);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10850
		    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10851
		    break;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10852
		}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10853
		if (cp) free(cp);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10854
		goto done;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10855
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10856
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10857
    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10858
fail:
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10859
    if (cp) free(cp);
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10860
    RETURN(nil);
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10861
done:;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10862
%}.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 10863
    ^ typeID->val
3977
40eb0d3cb208 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3975
diff changeset
 10864
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10865
    "Created: / 25-04-2018 / 16:41:52 / stefan"
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 10866
    "Modified: / 27-04-2018 / 11:40:05 / stefan"
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10867
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10868
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10869
primSetProperty:propertyID type:typeID value:anObject for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10870
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10871
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 10872
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 10873
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10874
    |retval|
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10875
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10876
    retval := false.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10877
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 10878
%{  /* UNLIMITEDSTACK */
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10879
    if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10880
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10881
	Atom prop, type;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10882
	Window window;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10883
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10884
	prop = __AtomVal(propertyID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10885
	type = __AtomVal(typeID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10886
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10887
	if (__isExternalAddress(aWindowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10888
	    window = __WindowVal(aWindowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10889
	} else if (aWindowID == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10890
	    window = DefaultRootWindow(dpy);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10891
	} else if (__isInteger(aWindowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10892
	    window = (Window)__unsignedLongIntVal(aWindowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10893
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10894
	    RETURN(false);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10895
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10896
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10897
	retval = true;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10898
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10899
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10900
	if (__isInteger(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10901
	    unsigned INT value = __longIntVal(anObject);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10902
	    XChangeProperty(dpy, window, prop, type, 32,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10903
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10904
			    (unsigned char *)&value, 1);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10905
	} else if (__isByteArrayLike(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10906
	    XChangeProperty(dpy, window, prop, type, 8,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10907
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10908
			    __byteArrayVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10909
			    __byteArraySize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10910
	} else if (__isWords(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10911
	    /* wordArray-like (16bit-string) object */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10912
	    XChangeProperty(dpy, window, prop, type, 16,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10913
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10914
			    __stringVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10915
			    __wordArraySize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10916
	} else if (__isIntegerArray(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10917
	    /* array of atoms */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10918
	    XChangeProperty(dpy, window, prop, type, 32,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10919
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10920
			    (char *)__integerArrayVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10921
			    __integerArraySize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10922
	} else if (__isStringLike(anObject)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10923
	    XChangeProperty(dpy, window, prop, type, 8,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10924
			    PropModeReplace,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10925
			    __stringVal(anObject),
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10926
			    __stringSize(anObject));
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10927
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10928
	    retval = false;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10929
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10930
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10931
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10932
	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
 10933
    }
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10934
%}.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 10935
    ^ retval
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10936
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10937
    "Created: / 26-04-2018 / 10:36:50 / stefan"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10938
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10939
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10940
propertiesOf:aWindowOrWindowIDOrNil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10941
    "return a collection of all properties' atomIDs of a window.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10942
     Returns the rootWindows props for a nil window argument."
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10943
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10944
    <context: #return>
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10945
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10946
    |windowID propertyAtoms|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10947
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10948
    aWindowOrWindowIDOrNil isView ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10949
	windowID := aWindowOrWindowIDOrNil drawableId.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10950
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10951
	windowID := aWindowOrWindowIDOrNil.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10952
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10953
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10954
%{
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10955
    Window window;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10956
    Atom *atomListPtr;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10957
    int i;
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10958
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10959
    if (ISCONNECTED) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10960
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10961
	int numProps = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10962
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10963
	if (__isExternalAddress(windowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10964
	    window = __WindowVal(windowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10965
	} else if (windowID == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10966
	    window = DefaultRootWindow(dpy);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10967
	} else if (__isInteger(windowID)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10968
	    window = (Window)__unsignedLongIntVal(windowID);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10969
	} else {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10970
	    goto fail;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10971
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10972
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10973
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10974
	atomListPtr = XListProperties(dpy, window, &numProps);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10975
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10976
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10977
	if (atomListPtr == NULL) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10978
	    RETURN (nil);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10979
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10980
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10981
	propertyAtoms = __ARRAY_NEW_INT(numProps);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10982
	if (propertyAtoms == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10983
	    goto fail;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10984
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10985
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10986
	for (i=0; i<numProps; i++) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10987
	    OBJ atm;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10988
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10989
	    atm = __MKATOMOBJ(atomListPtr[i]);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10990
	    __ArrayInstPtr(propertyAtoms)->a_element[i] = atm; __STORE(propertyAtoms, atm);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10991
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10992
	XFree(atomListPtr);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 10993
	RETURN (propertyAtoms);
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10994
    }
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10995
fail: ;
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
    ^ self primitiveFailed
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10998
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 10999
    "
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11000
     Display propertiesOf:nil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11001
     Display propertiesOf:Transcript id
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11002
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11003
     (Display propertiesOf:nil) collect:[:eachID | Display atomName:eachID]
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11004
     (Display propertiesOf:Transcript id) collect:[:eachID | Display atomName:eachID]
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11005
    "
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
    "Modified: / 26-04-2018 / 11:00:12 / stefan"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11008
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11009
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11010
setIcon:anIcon for:aWindowOrWindowID
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11011
    |buffer iWidth iHeight|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11012
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11013
    iWidth  := anIcon width.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11014
    iHeight := anIcon height.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11015
    buffer := IntegerArray new:(iWidth*iHeight+2).
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11016
    buffer at:1 put:iWidth.
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11017
    buffer at:2 put:iHeight.
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
    self setProperty:#'_NET_WM_ICON' type:#CARDINAL value:buffer for:aWindowOrWindowID
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
    "
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11022
	Display setIcon:0 for:Transcript
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11023
    "
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
    "Modified (comment): / 26-04-2018 / 10:59:17 / stefan"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11026
!
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11027
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11028
setProperty:propertySymbolOrAtomID type:typeSymbolOrAtomID value:anObject for:aWindowOrWindowIDOrNil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11029
    "set a property in the XServer"
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
    |propertyAtomID typeAtomID windowIDOrNil|
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11032
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11033
    propertySymbolOrAtomID isString ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11034
	propertyAtomID := self atomIDOf:propertySymbolOrAtomID create:false.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11035
	propertyAtomID isNil ifTrue:[^ false].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11036
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11037
	propertyAtomID := propertySymbolOrAtomID.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11038
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11039
    typeSymbolOrAtomID isString ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11040
	typeAtomID := self atomIDOf:typeSymbolOrAtomID create:false.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11041
	typeAtomID isNil ifTrue:[^ false].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11042
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11043
	typeAtomID := typeSymbolOrAtomID.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11044
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11045
    aWindowOrWindowIDOrNil isView ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11046
	windowIDOrNil := aWindowOrWindowIDOrNil drawableId.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11047
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11048
	windowIDOrNil := aWindowOrWindowIDOrNil.
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11049
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11050
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11051
    ^ self primSetProperty:propertyAtomID type:typeAtomID value:anObject for:windowIDOrNil
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 11052
8347
33f968a33916 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8346
diff changeset
 11053
    "Modified: / 27-04-2018 / 12:20:46 / stefan"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11054
! !
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11055
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11056
!XWorkstation methodsFor:'queries'!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11057
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11058
defaultExtentForTopViews
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11059
    "redefined, to define the default extent for the default monitor"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11060
    |extent|
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11061
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11062
    "the standard monitor is the first entry in monitorBounds"
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11063
    extent := self monitorBounds first extent.
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11064
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11065
    self isPDA ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11066
	^ extent - (16 @ 20)
5872
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11067
    ].
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11068
    ^ extent * 2 // 3
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11069
!
246b9c11d5a4 added: #defaultExtentForTopViews
Stefan Vogel <sv@exept.de>
parents: 5870
diff changeset
 11070
6332
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11071
isOpen
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11072
    "answer true, if device can be used"
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11073
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11074
    ^ displayId notNil and:[hasConnectionBroken not].
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11075
!
792a2b79c651 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
 11076
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11077
isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11078
%{  /* NOCONTEXT */
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11079
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11080
#ifdef XINERAMA
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11081
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11082
	Display *dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11083
	dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11084
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11085
	if (XineramaIsActive(dpy)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11086
	    RETURN ( true );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11087
	}
5869
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11088
    }
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11089
#endif
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11090
%}.
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11091
    ^ false
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11092
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11093
    "
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11094
     Display isXineramaActive
93ccf272ad13 added:6 methods
Stefan Vogel <sv@exept.de>
parents: 5865
diff changeset
 11095
    "
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11096
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
 11097
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11098
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11099
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11100
atomIDOf:aStringOrSymbol
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 11101
    "return an X11 atoms ID.
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11102
     This is highly X specific and only for local use (with selections).
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11103
     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
 11104
     speed up future lookups"
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11105
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11106
    ^ self atomIDOf:aStringOrSymbol create:true
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11107
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11108
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11109
     Display atomIDOf:#'FACE_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11110
     Display atomIDOf:#'FULL_NAME'
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11111
     Display atomIDOf:#DndProtocol
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11112
     Display atomIDOf:#DndSelection
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11113
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11114
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 11115
    "Modified: 4.4.1997 / 13:38:48 / cg"
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11116
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11117
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11118
atomIDOf:aStringOrSymbol create:create
3988
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11119
    "return an Atoms ID given its name.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11120
     If it already exists, return its ID.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11121
     If not and the create argument is true, it is created.
ccbd870bbfe3 clipboard UTF8 encoding
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
 11122
     Otherwise, nil is returned.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11123
     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
 11124
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11125
    |atomSymbol atom|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11126
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11127
    atomSymbol := aStringOrSymbol asSymbol.
7371
d88ae8653ca8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7352
diff changeset
 11128
    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:[nil]) notNil]) ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11129
	^ atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11130
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11131
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11132
    atom := self primAtomIDOf:atomSymbol create:create.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11133
    atom notNil ifTrue:[
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11134
	atoms isNil ifTrue:[
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11135
	    atoms := IdentityDictionary new.
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11136
	].
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 11137
	atoms at:atomSymbol put:atom.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11138
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11139
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11140
    ^ atom
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11141
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11142
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11143
     Display atomIDOf:#'VT_SELECTION' create:false
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11144
     Display atomIDOf:#CLIPBOARD create:false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11145
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11146
     Display atomIDOf:'PRIMARY' create:false
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11147
     Display atomIDOf:'blabla' create:false
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11148
    "
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11149
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11150
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11151
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11152
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11153
     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
 11154
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11155
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11156
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11157
%{
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11158
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11159
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11160
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11161
    if (ISCONNECTED && __isAtomID(anAtomID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11162
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11163
	name = XGetAtomName(myDpy, __AtomVal(anAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11164
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11165
	if (name == 0) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11166
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11167
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11168
	str = __MKSTRING(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11169
	XFree(name);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11170
	RETURN ( str );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11171
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11172
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11173
    self primitiveFailedOrClosedConnection.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11174
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11175
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11176
    "
3418
33b8326559a7 Font properties.
Stefan Vogel <sv@exept.de>
parents: 3417
diff changeset
 11177
     Display atomName:1    'PRIMARY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11178
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11179
     Display atomName:132  'FONTNAME_REGISTRY'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11180
     Display atomName:135 'FOUNDRY'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11181
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11182
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11183
     Display atomName:152 'CHARSET_ENCODING'
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11184
     Display atomName:154
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11185
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11186
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11187
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11188
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11189
    "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
 11190
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11191
     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
 11192
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11193
     Notice:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11194
	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
 11195
	styles or resources. This would make porting of applications
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11196
	to different platforms much more difficult (Windows has no resource
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11197
	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
 11198
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11199
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11200
     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
 11201
     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
 11202
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11203
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11204
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11205
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11206
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 11207
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11208
     && __isStringLike(name)
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11209
     && __isStringLike(cls)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
 11210
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11211
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11212
				  (char *) __stringVal(name));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11213
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11214
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11215
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11216
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11217
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11218
    ^ nil.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11219
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11220
    "if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11221
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11222
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11223
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11224
	 Display getResource:'Beep' class:'OpenWindows'
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11225
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11226
     if your ~/.Xdefaults contains an entry such as:
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11227
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11228
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11229
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11230
	 Display getResource:'beNiceToColormap' class:'any'
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11231
	 Display getResource:'beNiceToColormap' class:''
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
 11232
    "
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11233
!
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11234
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11235
primAtomIDOf:aStringOrSymbol create:create
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11236
    "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
 11237
     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
 11238
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11239
    <context: #return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11240
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11241
%{
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11242
    Atom prop;
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11243
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11244
    if (ISCONNECTED
5467
0685d08ef9b4 isStringLike / isArrayLike
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
 11245
     && __isStringLike(aStringOrSymbol)) {
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11246
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11247
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11248
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11249
				  (create == true) ? False : True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11250
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11251
	if (prop == None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11252
	    RETURN (nil);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11253
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11254
	RETURN ( __MKATOMOBJ(prop) );
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11255
    }
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11256
%}.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11257
    self primitiveFailedOrClosedConnection.
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11258
    ^ nil
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11259
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11260
    "
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11261
     Display primAtomIDOf:'VT_SELECTION' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11262
     Display primAtomIDOf:'CUT_BUFFER0' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11263
     Display primAtomIDOf:'STRING' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11264
     Display primAtomIDOf:'PRIMARY' create:false
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11265
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11266
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11267
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11268
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11269
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
 11270
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
 11271
    "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
 11272
     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
 11273
     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
 11274
     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
 11275
     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
 11276
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11277
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11278
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11279
    ((w <= 0) or:[h <= 0]) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11280
	self primitiveFailed.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11281
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11282
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11283
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11284
    rawInfo := Array new:8.
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11285
		  "1 -> bit order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11286
		  "2 -> depth"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11287
		  "3 -> bytes_per_line"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11288
		  "4 -> byte_order"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11289
		  "5 -> format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11290
		  "6 -> bitmap_unit"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11291
		  "7 -> bitmap_pad"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11292
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11293
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11294
    "/ 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
 11295
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11296
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11297
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
 11298
    (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
 11299
	info := IdentityDictionary new.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11300
	info at:#bitOrder put:(rawInfo at:1).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11301
	info at:#depth put:(rawInfo at:2).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11302
	info at:#bytesPerLine put:(rawInfo at:3).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11303
	info at:#byteOrder put:(rawInfo at:4).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11304
	info at:#format put:(rawInfo at:5).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11305
	info at:#bitmapUnit put:(rawInfo at:6).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11306
	info at:#bitmapPad put:(rawInfo at:7).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11307
	info at:#bitsPerPixel put:(rawInfo at:8).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11308
	^ info
7506
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11309
    ].
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11310
    "
184d2085d4fd #OTHER by mawalch
mawalch
parents: 7486
diff changeset
 11311
     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
 11312
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11313
    "
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11314
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11315
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11316
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11317
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
 11318
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
 11319
    "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
 11320
     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
 11321
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11322
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11323
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11324
%{  /* UNLIMITEDSTACK */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11325
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11326
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11327
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11328
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11329
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11330
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11331
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
 11332
     && __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
 11333
	win = __WindowVal(aDrawableId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11334
	xpos = __intVal(x);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11335
	ypos = __intVal(y);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11336
	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
 11337
	    RETURN ( __MKSMALLINT(0) );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11338
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11339
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11340
	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
 11341
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11342
	if (img != 0) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11343
	    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
 11344
	    XDestroyImage(img);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11345
	    RETURN (  __MKSMALLINT(ret) );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11346
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11347
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11348
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11349
    ^ nil
8367
e0d6816f072b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8358
diff changeset
 11350
e0d6816f072b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8358
diff changeset
 11351
    "Modified: / 17-05-2018 / 16:45:34 / Stefan Vogel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11352
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11353
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 11354
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
 11355
    "since XGetImage may allocate huge amount of stack space
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11356
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11357
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11358
    <context: #return>
3461
779f5d3cdcee dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
 11359
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11360
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11361
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
 11362
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11363
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11364
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11365
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11366
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 11367
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11368
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11369
     && __bothSmallInteger(w, h)
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11370
     && __isArray(info) && (__arraySize(info) >= 8)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11371
     && __isByteArray(imageBits)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11372
	Display *dpy = myDpy;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11373
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11374
	win = __WindowVal(aDrawableId);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11375
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11376
	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
 11377
				    __intVal(w), __intVal(h),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11378
				    (unsigned long)AllPlanes, ZPixmap);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11379
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11380
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11381
	if (! image) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11382
	    RETURN ( false );
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11383
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11384
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11385
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11386
#ifdef SUPERDEBUG
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11387
	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
 11388
#endif
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11389
	switch (image->depth) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11390
	    case 1:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11391
	    case 2:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11392
	    case 4:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11393
	    case 8:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11394
	    case 16:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11395
	    case 24:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11396
	    case 32:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11397
		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
 11398
		break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11399
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11400
	    default:
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11401
		/* unsupported depth ? */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11402
		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
 11403
		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
 11404
		break;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11405
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11406
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11407
#ifdef SUPERDEBUG
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11408
	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
 11409
#endif
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11410
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11411
	if (numBytes > __byteArraySize(imageBits)) {
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11412
	    /* imageBits too small */
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11413
	    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
 11414
	    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
 11415
	    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
 11416
				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
 11417
	    goto fail;
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11418
	}
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11419
	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
 11420
	    __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
 11421
	else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11422
	    __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
 11423
	__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
 11424
	__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
 11425
	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
 11426
	    __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
 11427
	else
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11428
	    __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
 11429
	if (image->format == XYBitmap)
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11430
	    __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
 11431
	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
 11432
	    __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
 11433
	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
 11434
	    __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
 11435
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11436
	__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
 11437
	__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
 11438
	__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
 11439
	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
 11440
	XDestroyImage(image);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11441
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11442
    }
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11443
fail:
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11444
    if (image) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 11445
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11446
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11447
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11448
    ^ false
8004
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11449
1d8a9208c16a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7983
diff changeset
 11450
    "Modified: / 11-04-2017 / 21:17:31 / cg"
8367
e0d6816f072b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8358
diff changeset
 11451
    "Modified: / 17-05-2018 / 16:45:14 / Stefan Vogel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11452
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11453
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11454
!XWorkstation methodsFor:'selection fetching'!
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 11455
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11456
getClipboardObjectFor:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11457
    "get the object selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11458
     Returns nil, if no selection is available.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11459
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11460
     Smalltalk puts ST_OBJECT only into the CLIPBOARD"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11461
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11462
    |selectionOwnerWindowId selection|
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11463
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11464
    selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom.
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11465
    (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
 11466
				     Get the selection from our own buffer"
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11467
     or:[self viewIdKnown:selectionOwnerWindowId]) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11468
	"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
 11469
	^ copyBuffer
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11470
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11471
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11472
    drawableId isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11473
	"sorry, cannot fetch a selection, if there is no drawableId.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11474
	 Should I borrow a drawableId from another window?"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11475
	^ nil.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11476
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11477
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11478
    selection := SelectionFetcher
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11479
	requestSelection:clipboardAtom
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11480
	type:(self atomIDOf:#'ST_OBJECT')
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11481
	onDevice:self for:drawableId.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11482
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11483
    "/ should not happen
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11484
    "/ 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
 11485
"/    selection isEmptyOrNil ifTrue:[
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11486
"/        selection := SelectionFetcher
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11487
"/            requestSelection:clipboardAtom
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11488
"/            type:(self atomIDOf:#'UTF8_STRING')
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11489
"/            onDevice:self for:drawableId.
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11490
"/
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11491
"/        selection isNil ifTrue:[
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11492
"/            selection := SelectionFetcher
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11493
"/                requestSelection:clipboardAtom
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11494
"/                type:(self atomIDOf:#STRING)
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11495
"/                onDevice:self for:drawableId.
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11496
"/        ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11497
"/    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11498
5993
979e2a2f250b class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 5989
diff changeset
 11499
    selection isEmptyOrNil ifTrue:[ ^ copyBuffer ].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11500
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11501
    ^ selection.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11502
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11503
    "
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11504
       Display getClipboardObjectFor:Transcript drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11505
    "
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11506
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11507
    "Modified (comment): / 27-04-2018 / 13:39:41 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11508
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11509
4280
52421b26c983 get selection interface changed
ca
parents: 4277
diff changeset
 11510
getClipboardText:selectionBufferSymbol for:drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11511
    "get the text selection.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11512
     Returns nil, if no selection is available"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11513
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11514
    |selectionId selectionOwnerWindowId selection|
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11515
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11516
    selectionBufferSymbol == #selection ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11517
	selectionId := primaryAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11518
    ] ifFalse:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11519
	selectionId := clipboardAtom.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11520
    ].
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11521
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11522
    selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11523
    (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
 11524
				     Get the selection from our own buffer"
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11525
     or:[self viewIdKnown:selectionOwnerWindowId]) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11526
	"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
 11527
	"JV@2012-04-02: Added support for PRIMARY/SELECTION buffers."
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11528
	^ selectionId == primaryAtom ifTrue:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11529
	    self primaryBufferAsString
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11530
	] ifFalse:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11531
	    self copyBufferAsString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11532
	]
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11533
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11534
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11535
    drawableId isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11536
	"sorry, cannot fetch a selection, if there is no drawableId.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11537
	 Should I borrow a drawableId from another window?"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11538
	 ^ nil.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11539
    ].
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11540
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11541
    selection := SelectionFetcher
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11542
	requestSelection:selectionId
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11543
	type:(self atomIDOf:#'UTF8_STRING')
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11544
	onDevice:self for:drawableId.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11545
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11546
    selection isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11547
	selection := SelectionFetcher
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11548
	    requestSelection:selectionId
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11549
	    type:(self atomIDOf:#STRING)
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11550
	    onDevice:self for:drawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11551
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11552
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11553
    ^ selection
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11554
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11555
     "
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11556
       Display getClipboardText:#clipboard for:Transcript drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11557
       Display getClipboardText:#selection for:Transcript drawableId
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11558
     "
5899
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11559
3049e637309f fix: #getClipboardText:for: (support from PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5898
diff changeset
 11560
    "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
 11561
    "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
 11562
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11563
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11564
!XWorkstation methodsFor:'selection sending'!
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11565
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11566
selectionBuffer:bufferGetSelector as:aTargetAtomID
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11567
    "convert the current selection to the format defined by aTargetAtom.
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11568
     Answer an association with the type of converted selection (an atomID)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11569
     and the converted selection"
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11570
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11571
    |buffer bufferAsString|
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11572
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11573
    buffer := self perform:bufferGetSelector.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11574
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11575
    (aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11576
	"/ 'st-object' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11577
	"send the selection in binaryStore format"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11578
	"require libboss to be loaded"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11579
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11580
	    Logger error:'cannot use binary store for copy buffer (libboss missing)'.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11581
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11582
	].
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11583
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11584
	[
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11585
	    ^ aTargetAtomID -> (buffer binaryStoreBytes).
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11586
	] on:Error do:[:ex|
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11587
	    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
 11588
	    ^ nil -> nil.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11589
	].
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11590
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11591
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11592
    bufferAsString := self class bufferAsString:buffer.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11593
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11594
    (aTargetAtomID == (self atomIDOf:#STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11595
     or:[aTargetAtomID == (self atomIDOf:#'text/plain')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11596
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11597
	"/ 'string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11598
	"the other view wants the selection as string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11599
	^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11600
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11601
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11602
    (aTargetAtomID == (self atomIDOf:#UTF8_STRING)
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11603
     or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')]
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11604
    ) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11605
	"/ 'utf string' printCR.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11606
	"the other view wants the selection as utf8 string"
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11607
	^ aTargetAtomID -> (bufferAsString utf8Encoded).
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11608
    ].
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11609
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11610
    aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[
7509
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11611
	"the other one wants to know the size of our selection.
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11612
	 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
 11613
	 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
 11614
d18f375ac80d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7507
diff changeset
 11615
	^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
3797
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11616
    ].
a5b60da8de9a Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents: 3794
diff changeset
 11617
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11618
    "we do not support the requestet target type"
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11619
    ^ nil -> nil.
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11620
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 11621
    "Modified: / 23-08-2006 / 15:56:08 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11622
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11623
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11624
setClipboardObject:anObject owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11625
    "set the object selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11626
     This can be used by other Smalltalk(X) applications only.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11627
     We set only the CLIPBOARD selection"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11628
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11629
    clipboardSelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11630
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11631
!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11632
4277
8f458181af3f set selection interface changed
ca
parents: 4271
diff changeset
 11633
setClipboardText:aString owner:aWindowId
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11634
    "set the text selection, and make aWindowId be the owner.
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11635
     This can be used by any other X application.
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11636
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11637
     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
 11638
     into xterm."
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11639
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11640
    clipboardSelectionTime := primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11641
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11642
    self setSelectionOwner:aWindowId of:clipboardAtom time:clipboardSelectionTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11643
    self setSelectionOwner:aWindowId of:primaryAtom time:primarySelectionTime.
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11644
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11645
    "Modified: / 17.6.1998 / 19:48:54 / cg"
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11646
!
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11647
5898
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11648
setPrimaryText:aString owner:aWindowId
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11649
    "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
 11650
     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
 11651
     pasting. X Window specific."
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11652
6160
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11653
    primarySelectionTime := lastEventTime.
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11654
3ea2f08308ae class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6159
diff changeset
 11655
    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
 11656
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11657
    "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
 11658
!
3fbf04bffa7a Support for X's PRIMARY selection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5893
diff changeset
 11659
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11660
supportedTargetAtoms
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11661
    "answer an integer array containing the list of supported targets
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11662
     i.e. supported clipboard formats"
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11663
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 11664
    "Note: some sender code assumes that ST_OBJECT is first"
8225
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11665
    ^ #(
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11666
	ST_OBJECT
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11667
	STRING
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11668
	UTF8_STRING
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11669
	TIMESTAMP
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11670
	TARGETS
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11671
	LENGTH
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11672
	#'text/plain'
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11673
	#'text/plain;codeset=utf-8'
8225
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11674
    ) collect:[:eachTargetSymbol| self atomIDOf:eachTargetSymbol] as:IntegerArray.
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11675
88de54496ec6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8189
diff changeset
 11676
    "Modified (format): / 24-11-2017 / 11:06:23 / cg"
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11677
! !
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11678
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11679
!XWorkstation methodsFor:'selections-basic'!
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11680
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11681
getSelectionOwnerOf:selectionAtomSymbolOrID
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11682
    "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
 11683
     Answer nil, if there is no owner"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11684
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11685
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11686
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11687
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11688
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11689
    selectionAtomSymbolOrID isString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11690
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11691
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11692
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11693
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11694
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11695
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11696
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11697
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11698
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11699
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11700
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11701
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11702
	window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11703
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11704
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11705
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11706
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11707
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11708
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11709
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11710
4271
6540e99ff64c do not remove seletionNotification
Claus Gittinger <cg@exept.de>
parents: 4268
diff changeset
 11711
requestSelection:selectionID type:typeID for:aWindowId intoProperty:propertyID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11712
    "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
 11713
     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
 11714
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11715
3794
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11716
    <context:#return>
3b5fbd07d46d Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents: 3792
diff changeset
 11717
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11718
    |anIntegerTimestamp|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11719
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11720
    anIntegerTimestamp := lastEventTime.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11721
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11722
%{
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11723
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11724
    if (ISCONNECTED
3779
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11725
     && __isAtomID(typeID)
84c9c261f510 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3778
diff changeset
 11726
     && __isAtomID(propertyID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11727
     && __isAtomID(selectionID)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11728
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11729
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11730
	Time time;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11731
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11732
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11733
	    w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11734
	} else if (aWindowId == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11735
	    w = (Window)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11736
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11737
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11738
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11739
	if (anIntegerTimestamp == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11740
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11741
	     * 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
 11742
	     * the selection was requested and not to CurrentTime
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11743
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11744
	    time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11745
	} else if (__isInteger(anIntegerTimestamp)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11746
	    time = __unsignedLongIntVal(anIntegerTimestamp);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11747
	} else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11748
	    goto err;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11749
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11750
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11751
	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11752
			       __AtomVal(propertyID), w, time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11753
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11754
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11755
	RETURN (true);
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11756
err:;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11757
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11758
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11759
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11760
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11761
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11762
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11763
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11764
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11765
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11766
	type:(Display atomIDOf:'STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11767
	for:Transcript id
3985
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 11768
    "
91e8c80b2a23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3977
diff changeset
 11769
    "
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11770
     Display
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11771
	requestSelection:(Display atomIDOf:'PRIMARY')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11772
	property:(Display atomIDOf:'VT_SELECTION')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11773
	type:(Display atomIDOf:'C_STRING')
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11774
	for:Transcript id
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11775
    "
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11776
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11777
4286
6a2d3474db8a Fix name botch on solaris
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
 11778
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
 11779
    "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
 11780
     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
 11781
     could not be converted.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 11782
     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
 11783
     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
 11784
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11785
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11786
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 11787
    if (ISCONNECTED
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11788
	&& (__isAtomID(propertyID) || propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11789
	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11790
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11791
	XEvent ev;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11792
	Window requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11793
	Status result;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11794
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11795
	if (__isExternalAddress(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11796
	    requestor = __WindowVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11797
	} else if (__isSmallInteger(requestorID)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11798
	    requestor = (Window)__smallIntegerVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11799
	} else if (requestorID == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11800
	    requestor = DefaultRootWindow(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11801
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11802
	    requestor = (Window)__unsignedLongIntVal(requestorID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11803
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11804
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11805
	ev.xselection.type = SelectionNotify;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11806
	ev.xselection.display = dpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11807
	ev.xselection.selection = __AtomVal(selectionID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11808
	ev.xselection.target = __AtomVal(targetID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11809
	ev.xselection.requestor = requestor;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11810
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11811
	if (__isExternalAddress(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11812
	    ev.xselection.time = (INT)(__externalAddressVal(aTime));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11813
	} else if (__isSmallInteger(aTime)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11814
	    ev.xselection.time = __smallIntegerVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11815
	} else if (aTime == nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11816
	    ev.xselection.time = CurrentTime;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11817
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11818
	    ev.xselection.time = (INT)__unsignedLongIntVal(aTime);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11819
	}
3238
542bbbf55014 event stuff
Claus Gittinger <cg@exept.de>
parents: 3234
diff changeset
 11820
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11821
	console_printf("ev.xselection.selection: %x\n", ev.xselection.selection);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11822
	console_printf("ev.xselection.target: %x\n", ev.xselection.target);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11823
	console_printf("ev.xselection.requestor: %x\n", ev.xselection.requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11824
	console_printf("ev.xselection.time: %x\n", ev.xselection.time);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11825
	console_printf("requestor: %x\n", requestor);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11826
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11827
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11828
	/* send nil property if selection cannot be converted */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11829
	if (propertyID == nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11830
	    ev.xselection.property = None;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11831
	else
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11832
	    ev.xselection.property = __AtomVal(propertyID);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11833
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11834
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11835
	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
 11836
		(INT)ev.xselection.selection,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11837
		(INT)ev.xselection.property,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11838
		(INT)ev.xselection.target,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11839
		(INT)ev.xselection.requestor,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11840
		(INT)requestor));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11841
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11842
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11843
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11844
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11845
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11846
	if ((result == BadValue) || (result == BadWindow)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11847
	    DPRINTF(("bad status\n"));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11848
	    RETURN (false);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11849
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11850
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11851
	XFlush(dpy);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11852
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11853
	RETURN (true)
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11854
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11855
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11856
    self primitiveFailedOrClosedConnection.
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
 11857
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11858
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11859
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11860
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11861
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11862
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID time:anIntegerTimestamp
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11863
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11864
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11865
    <context: #return>
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11866
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11867
    |selectionAtomID|
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11868
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11869
    selectionAtomSymbolOrID isString ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11870
	selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11871
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11872
	selectionAtomID := selectionAtomSymbolOrID.
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11873
    ].
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11874
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 11875
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11876
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11877
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11878
    if (__isExternalAddress(aWindowId)
3320
20c37636e4b8 Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents: 3319
diff changeset
 11879
     && __isAtomID(selectionAtomID)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11880
     && ISCONNECTED) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11881
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11882
	Time time;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11883
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11884
	win = __WindowVal(aWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11885
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11886
	if (anIntegerTimestamp == nil) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11887
	    /*
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11888
	     * 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
 11889
	     * the selection was acquired and not to CurrentTime
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11890
	     */
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11891
	    time = CurrentTime;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11892
	} else if (__isInteger(anIntegerTimestamp)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11893
	    time = __unsignedLongIntVal(anIntegerTimestamp);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11894
	} else
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11895
	    goto err;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11896
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11897
	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
 11898
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11899
	XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, time);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11900
	RETURN (self);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 11901
	LEAVE_XLIB();
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11902
    }
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 11903
err:;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
 11904
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 11905
    self primitiveFailedOrClosedConnection.
8346
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11906
67c9eddbc4ba #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8342
diff changeset
 11907
    "Modified: / 27-04-2018 / 11:56:21 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11908
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 11909
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11910
!XWorkstation methodsFor:'window queries'!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11911
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11912
allChildIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11913
    "return all children-ids of the given window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11914
     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
 11915
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11916
    |childIDs allChildIDs|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11917
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11918
    allChildIDs := OrderedCollection new.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11919
    childIDs := self childIdsOf:aWindowId.
4411
5e5d008efba2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
 11920
    childIDs notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11921
	allChildIDs addAll:childIDs.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11922
	childIDs do:[:eachChildId |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11923
	    allChildIDs addAll:(self allChildIdsOf:eachChildId).
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11924
	].
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11925
    ].
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11926
    ^ allChildIDs
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11927
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11928
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11929
     Display allChildIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11930
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11931
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11932
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11933
     |deviceIDAtom uuidAtom|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11934
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11935
     deviceIDAtom := (Display atomIDOf:#'STX_DEVICE_ID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11936
     uuidAtom     := (Display atomIDOf:#'UUID').
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11937
     (Display allChildIdsOf:(Display rootWindowId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11938
	select:[:id |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11939
	    |uuid|
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11940
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11941
	    Display
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11942
		getProperty:deviceIDAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11943
		from:id
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11944
		delete:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11945
		into:[:type :value |
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11946
		    type == uuidAtom ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11947
			uuid := UUID fromBytes:value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11948
		    ].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11949
		].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11950
	    uuid notNil.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 11951
	]
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11952
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11953
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11954
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11955
childIdsOf:aWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11956
    "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
 11957
     enumerated, if we start at the root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11958
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 11959
    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 11960
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11961
    |childIdArray|
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11962
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11963
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11964
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11965
    if (ISCONNECTED
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11966
     && __isExternalAddress(aWindowId)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11967
	Display *dpy = myDpy;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11968
	Window win = __WindowVal(aWindowId);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11969
	Window rootReturn, parentReturn;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11970
	Window* children = (Window *)0;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11971
	unsigned int numChildren;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11972
	int i;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11973
	int rslt;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11974
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11975
	ENTER_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11976
	rslt = XQueryTree(dpy, win,
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11977
		       &rootReturn, &parentReturn,
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11978
		       &children, &numChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11979
	LEAVE_XLIB();
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11980
	if (rslt) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11981
	    childIdArray = __ARRAY_NEW_INT(numChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11982
	    if (childIdArray != nil) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11983
		for (i=0; i < numChildren; i++) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11984
		    if (children[i]) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11985
			OBJ childId;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11986
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11987
			childId = __MKEXTERNALADDRESS(children[i]);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11988
			__ArrayInstPtr(childIdArray)->a_element[i] = childId;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11989
			__STORE(childIdArray, childId);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11990
		    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11991
		}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11992
		if (children) XFree(children);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11993
	    }
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11994
	    RETURN (childIdArray);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 11995
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11996
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11997
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11998
    ^ nil.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 11999
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12000
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12001
      Display childIdsOf:(Display rootWindowId)
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12002
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12003
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12004
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12005
realRootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12006
    "return the id of the real root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12007
     This may not be the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12008
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12009
     of it. Except for very special cases, use #rootWindowId, which takes
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12010
     care of any virtual root."
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12011
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12012
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12013
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12014
    Window root;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12015
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12016
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12017
    if (__INST(rootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12018
	RETURN (__INST(rootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12019
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12020
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12021
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12022
	root = RootWindow(myDpy, screen);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12023
	if (! root) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12024
	    id = nil;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12025
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12026
	    id = __MKEXTERNALADDRESS(root); __INST(rootId) = id; __STORE(self, id);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12027
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12028
	RETURN (id);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12029
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12030
%}.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12031
    self primitiveFailedOrClosedConnection.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12032
    ^ nil
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12033
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12034
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12035
      Display rootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12036
      Display realRootWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12037
    "
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12038
!
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12039
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12040
rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12041
    "return the id of the root window.
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12042
     This is the window you see as background,
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12043
     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
 12044
     since some window managers install a virtual root window on top
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12045
     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
 12046
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12047
%{
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12048
    int screen = __intVal(__INST(screen));
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12049
    Window rootWin, vRootWin = 0;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12050
    OBJ id;
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12051
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12052
    if (__INST(virtualRootId) != nil) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12053
	RETURN (__INST(virtualRootId));
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12054
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12055
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12056
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12057
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12058
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12059
	rootWin = RootWindow(dpy, screen);
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12060
#ifndef IRIS
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12061
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12062
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12063
	 * on IRIS, this creates a badwindow error - why ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12064
	 * children contains a funny window (000034)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12065
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12066
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12067
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12068
	 * care for virtual root windows (tvtwm & friends)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12069
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12070
	{
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12071
	    Atom vRootAtom, kwinAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12072
	    int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12073
	    Window rootReturn, parentReturn;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12074
	    Window* children = (Window *)0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12075
	    unsigned int numChildren;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12076
	    int ignoreVRoot = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12077
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12078
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12079
	     * Take care of KDE 2.1.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12080
	     * they define _SWM_ROOT but this is not the parent of
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12081
	     * the application windows.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12082
	     * Instead it is used for background painting
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12083
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12084
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12085
	    kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12086
	    if (kwinAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12087
		Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12088
		int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12089
		unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12090
		unsigned char *retVal = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12091
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12092
		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12093
				       0L, 1L, False, kwinAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12094
				       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12095
				       &nitems, &bytesafter, &retVal) == Success
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12096
			      && actual_type != 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12097
		if (retVal)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12098
		    XFree(retVal);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12099
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12100
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12101
	    if (!ignoreVRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12102
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12103
		if (vRootAtom != None) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12104
		    if (XQueryTree(dpy, rootWin,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12105
				       &rootReturn, &parentReturn,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12106
				       &children, &numChildren)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12107
			for (i=0; i < numChildren; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12108
			    Atom actual_type;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12109
			    int actual_format;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12110
			    unsigned long nitems, bytesafter;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12111
			    Window* newRoot = (Window*) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12112
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12113
			    if (children[i]) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12114
				if (XGetWindowProperty(dpy, children[i], vRootAtom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12115
						       0L, 1L, False, XA_WINDOW,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12116
						       &actual_type, &actual_format,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12117
						       &nitems, &bytesafter,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12118
						       (unsigned char**) &newRoot
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12119
						      ) == Success && newRoot) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12120
				    vRootWin = *newRoot;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12121
				    XFree(newRoot); /* XXX */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12122
				    break;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12123
				}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12124
			    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12125
			}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12126
			if (children) XFree(children);
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
		}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12129
	     }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12130
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12131
#endif
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12132
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12133
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12134
    if (! vRootWin) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12135
	vRootWin = rootWin;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12136
	if (! vRootWin) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12137
	    RETURN ( nil );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12138
	}
4410
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12139
    }
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12140
    id = __MKEXTERNALADDRESS(rootWin); __INST(rootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12141
    id = __MKEXTERNALADDRESS(vRootWin); __INST(virtualRootId) = id; __STORE(self, id);
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12142
    RETURN ( id );
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12143
%}
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12144
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12145
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12146
      Display rootWindowId
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12147
    "
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12148
! !
4001d5ec5fcf uniqueID for Alstom
Claus Gittinger <cg@exept.de>
parents: 4409
diff changeset
 12149
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12150
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12151
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12152
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12153
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12154
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12155
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12156
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12157
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12158
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12159
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12160
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12161
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12162
	 && __bothSmallInteger(x, y)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12163
	 && __bothSmallInteger(width, height)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12164
	    w = __intVal(width);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12165
	    h = __intVal(height);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12166
	    /*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12167
	     * 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
 12168
	     */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12169
	    if ((w >= 0) && (h >= 0)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12170
		ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12171
		XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12172
		LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12173
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12174
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12175
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12176
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12177
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12178
    self primitiveFailedOrClosedConnection.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12179
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12180
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12181
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12182
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12183
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12184
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12185
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12186
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12187
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12188
	if (__isExternalAddress(aWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12189
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12190
	    XClearWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12191
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12192
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12193
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12194
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12195
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12196
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12197
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12198
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12199
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12200
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12201
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12202
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12203
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12204
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12205
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12206
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12207
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12208
    if (ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12209
	if (__isExternalAddress(aWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12210
	 && __isExternalAddress(siblingId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12211
	    if (modeSymbol == @symbol(above)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12212
		chg.stack_mode = Above;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12213
	    } else if (modeSymbol == @symbol(below)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12214
		chg.stack_mode = Below;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12215
	    } else if (modeSymbol == @symbol(topIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12216
		chg.stack_mode = TopIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12217
	    } else if (modeSymbol == @symbol(bottomIf)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12218
		chg.stack_mode = BottomIf;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12219
	    } else if (modeSymbol == @symbol(opposite)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12220
		chg.stack_mode = Opposite;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12221
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12222
		mask = CWSibling;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12223
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12224
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12225
	    chg.sibling = __WindowVal(siblingId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12226
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12227
	    XConfigureWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12228
				    mask, &chg);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12229
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12230
	    RETURN ( self );
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12231
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12232
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12233
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12234
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12235
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12236
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12237
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12238
getGeometryOf:aWindowId
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12239
    "get a windows geometry.
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12240
     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
 12241
     decoration views (top label, resize boundaries etc.).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12242
     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
 12243
     relative to such a wrapper.
8386
184439a867ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8368
diff changeset
 12244
     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
 12245
     (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
 12246
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12247
    <context: #return>
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12248
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12249
    |x y width height depth borderWidth info|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12250
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12251
%{
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12252
    int x_ret, y_ret;
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12253
    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
 12254
		 border_width_ret, depth_ret;
3790
43261db5b846 Fix clipboard handling.
Stefan Vogel <sv@exept.de>
parents: 3789
diff changeset
 12255
    Window root_ret;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12256
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12257
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12258
     && __isExternalAddress(aWindowId)) {
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12259
	ENTER_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12260
	XGetGeometry(myDpy, __WindowVal(aWindowId),
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12261
		     &root_ret,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12262
		     &x_ret, &y_ret,
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12263
		     &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
 12264
		     &depth_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12265
	LEAVE_XLIB();
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12266
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12267
	x = __MKSMALLINT(x_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12268
	y = __MKSMALLINT(y_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12269
	width = __MKSMALLINT(width_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12270
	height = __MKSMALLINT(height_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12271
	depth = __MKSMALLINT(depth_ret);
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12272
	borderWidth = __MKSMALLINT(border_width_ret);
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12273
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12274
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12275
    borderWidth isNil ifTrue:[
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12276
	self primitiveFailedOrClosedConnection.
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12277
	^ nil
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12278
    ].
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12279
    info := Dictionary new.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12280
    info at:#origin put:(x @ y).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12281
    info at:#extent put:(width @ height).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12282
    info at:#depth  put:depth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12283
    info at:#borderWidth put:borderWidth.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12284
    ^ info
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12285
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12286
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12287
     Transcript topView device
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12288
	getGeometryOf:(Transcript id)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12289
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12290
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12291
     Transcript topView device
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12292
	getGeometryOf:(Transcript topView id)
4024
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12293
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12294
    "
ca50cff73e41 comment
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
 12295
     Display
8475
e1e3fa52dac0 warning if an invalid width/height is reported by X
Claus Gittinger <cg@exept.de>
parents: 8443
diff changeset
 12296
	getGeometryOf:(Display viewIdFromUser)
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12297
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12298
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12299
     |d|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12300
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12301
     d := Transcript topView device.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12302
     d getGeometryOf:(d parentWindowIdOf:Transcript topView id)
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12303
    "
8386
184439a867ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8368
diff changeset
 12304
184439a867ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8368
diff changeset
 12305
    "Modified: / 14-06-2018 / 10:20:52 / Claus Gittinger"
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12306
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12307
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12308
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12309
    "return true, if the given window ID is (still) valid.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12310
     Especially useful, if the passed windowID is
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12311
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12312
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12313
"/ Enable when enabling ENTER_XLIB() below
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12314
"/    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12315
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12316
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12317
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12318
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12319
%{
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12320
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12321
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12322
     && __isExternalAddress(aWindowId)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12323
	char *name = NULL;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12324
	Status ok;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12325
	Window root, parent, *children = NULL;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12326
	unsigned int nChildren;
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12327
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12328
/*        ENTER_XLIB(); */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12329
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12330
			&root, &parent, &children, &nChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12331
	if (children) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12332
	    XFree(children);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12333
	}
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12334
/*        LEAVE_XLIB();   */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12335
	if (ok) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12336
	    RETURN (true);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12337
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12338
	RETURN (false);
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12339
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12340
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12341
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12342
    ^ false
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12343
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12344
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12345
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12346
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12347
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12348
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12349
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12350
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12351
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12352
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12353
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12354
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12355
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12356
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12357
    "
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12358
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12359
    "Modified: / 03-05-2018 / 16:28:44 / stefan"
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12360
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
 12361
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12362
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12363
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12364
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12365
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12366
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12367
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12368
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12369
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12370
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12371
	XLowerWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12372
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12373
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12374
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12375
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12376
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12377
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12378
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12379
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12380
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12381
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12382
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12383
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12384
    "make a window visible - either as icon or as a real view
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12385
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12386
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
 12387
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12388
4480
3e1449309dfa Set icon mask in #mapWindow:....
Stefan Vogel <sv@exept.de>
parents: 4478
diff changeset
 12389
    |wicon wiconId iconMaskId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12390
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12391
    aBoolean ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12392
	wicon := aView icon.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12393
	wicon notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12394
	    wiconId := wicon drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12395
	    wicon mask notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12396
		iconMaskId := wicon mask drawableId.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12397
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12398
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12399
	wiconView := aView iconView.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12400
	wiconView notNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12401
	    wiconViewId := wiconView drawableId
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12402
	].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12403
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12404
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12405
    minExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12406
	minW := minExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12407
	minH := minExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12408
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12409
    maxExt notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12410
	maxW := maxExt x.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12411
	maxH := maxExt y.
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
 12412
    ].
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12413
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12414
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12415
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12416
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12417
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12418
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12419
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12420
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12421
	Display *dpy = myDpy;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12422
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12423
	win = __WindowVal(aWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12424
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12425
	szhints.flags = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12426
	if (__bothSmallInteger(xPos, yPos)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12427
	    szhints.x = __intVal(xPos);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12428
	    szhints.y = __intVal(yPos);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12429
	    szhints.flags |= USPosition;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12430
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12431
	if (__bothSmallInteger(w, h)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12432
	    szhints.width = __intVal(w);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12433
	    szhints.height = __intVal(h);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12434
	    szhints.flags |= USSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12435
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12436
	if (__bothSmallInteger(minW, minH)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12437
	    szhints.flags |= PMinSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12438
	    szhints.min_width = __intVal(minW);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12439
	    szhints.min_height = __intVal(minH);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12440
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12441
	if (__bothSmallInteger(maxW, maxH)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12442
	    szhints.flags |= PMaxSize;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12443
	    szhints.max_width = __intVal(maxW);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12444
	    szhints.max_height = __intVal(maxH);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12445
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12446
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12447
	if (aBoolean == true) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12448
	    char *windowName = "";
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12449
	    Pixmap iconBitmap = (Pixmap)0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12450
	    Pixmap iconMask = (Pixmap)0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12451
	    Window iconWindow = (Window)0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12452
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12453
	    if (__isExternalAddress(wiconId))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12454
		iconBitmap = __PixmapVal(wiconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12455
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12456
	    if (__isExternalAddress(iconMaskId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12457
		iconMask = __PixmapVal(iconMaskId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12458
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12459
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12460
	    if (__isExternalAddress(wiconViewId))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12461
		iconWindow = __WindowVal(wiconViewId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12462
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12463
	    if (__isStringLike(wlabel))
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12464
		windowName = (char *) __stringVal(wlabel);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12465
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12466
	    if (iconBitmap || windowName) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12467
		ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12468
		XSetStandardProperties(dpy, win,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12469
					windowName, windowName,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12470
					iconBitmap,
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12471
					0, 0, &szhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12472
		LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12473
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12474
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12475
	    wmhints.flags = 0;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12476
	    if (iconBitmap) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12477
		wmhints.flags |= IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12478
		wmhints.icon_pixmap = iconBitmap;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12479
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12480
	    if (iconMask) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12481
		wmhints.flags |= IconMaskHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12482
		wmhints.icon_mask = iconMask;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12483
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12484
	    if (iconWindow) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12485
		wmhints.flags |= IconWindowHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12486
		wmhints.icon_window = iconWindow;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12487
	    }
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12488
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12489
	    wmhints.initial_state = IconicState;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12490
	    wmhints.flags |= StateHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12491
	    ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12492
	    XSetWMHints(dpy, win, &wmhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12493
	    LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12494
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12495
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12496
	if (szhints.flags) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12497
	    ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12498
	    XSetNormalHints(dpy, win, &szhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12499
	    LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12500
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12501
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12502
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12503
	XMapWindow(dpy, win);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12504
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 12505
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12506
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12507
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12508
    self primitiveFailedOrClosedConnection
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 12509
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 12510
    "Modified: / 26-04-2018 / 11:01:29 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12511
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12512
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12513
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12514
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12515
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12516
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12517
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12518
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12519
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12520
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12521
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12522
	XMapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12523
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12524
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12525
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12526
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12527
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12528
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12529
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12530
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12531
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12532
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12533
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12534
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12535
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12536
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12537
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12538
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12539
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12540
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12541
     && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12542
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12543
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12544
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12545
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12546
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12547
	XMoveResizeWindow(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12548
			      __intVal(x), __intVal(y),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12549
			      newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12550
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12551
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12552
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12553
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12554
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12555
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12556
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12557
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12558
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12559
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12560
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12561
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12562
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12563
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12564
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12565
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12566
	XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12567
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12568
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12569
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12570
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12571
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12572
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12573
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12574
newGraphicsContextFor:aGraphicsMedium
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12575
    "Redefined to use my own device specific graphics context"
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12576
7486
c3a1433996ec #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7478
diff changeset
 12577
    ^ X11GraphicsContext onDevice:self.
7413
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12578
!
3ecf41208027 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7409
diff changeset
 12579
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12580
parentWindowIdOf:aWindowId
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12581
    "return a windows parent-window id.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12582
     Useful with getGeometryOf:, to compute information about the decoration."
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12583
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12584
"/ Enable when enabling ENTER_XLIB() below
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12585
"/    <context: #return>
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12586
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12587
%{
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12588
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12589
    if (ISCONNECTED
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12590
     && __isExternalAddress(aWindowId)) {
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12591
	Status ok;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12592
	Window root, parent, *children = NULL;
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12593
	unsigned int nChildren;
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12594
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12595
/*        ENTER_XLIB(); */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12596
	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12597
			&root, &parent, &children, &nChildren);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12598
	if (children) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12599
	    XFree(children);
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12600
	}
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12601
/*        LEAVE_XLIB();   */
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12602
	if (! ok) {
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12603
	    RETURN ( nil );
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12604
	}
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 12605
	RETURN ( __MKEXTERNALADDRESS(parent) );
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12606
    }
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12607
%}.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12608
    self primitiveFailedOrClosedConnection.
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12609
    ^ false
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12610
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12611
    "
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12612
     |id|
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12613
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12614
     id := Transcript device parentWindowIdOf:(Transcript id).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12615
     self assert: ( Transcript container id = id ).
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12616
    "
8351
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12617
9f5fd3b800df #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 8350
diff changeset
 12618
    "Modified: / 03-05-2018 / 16:29:19 / stefan"
3789
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12619
!
712d129efee8 added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
 12620
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12621
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12622
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12623
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12624
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12625
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12626
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12627
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12628
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12629
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12630
	XRaiseWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12631
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12632
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12633
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12634
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12635
    self primitiveFailedOrClosedConnection
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12636
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12637
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12638
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12639
    "change a windows parent (an optional interface)"
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12640
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12641
    <context: #return>
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12642
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12643
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12644
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12645
     && __isExternalAddress(newParentWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12646
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12647
	Window _child, _newParent;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12648
	int i;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12649
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12650
	_child = __WindowVal(windowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12651
	_newParent = __WindowVal(newParentWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12652
	ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12653
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12654
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12655
	XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12656
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12657
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12658
	/*
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12659
	 * Code 'stolen' from xswallow source ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12660
	 * ... mhmh - what is this loop for ?
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12661
	 */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12662
	for (i=0; i<5; i++) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12663
	    XReparentWindow (dpy, _child, _newParent, 0, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12664
	    XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12665
	}
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
 12666
#if 0
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12667
	XMapWindow (dpy, _child);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12668
	XSync (dpy, 0);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12669
#endif
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12670
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12671
	RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12672
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12673
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12674
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12675
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12676
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12677
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12678
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12679
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12680
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12681
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12682
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12683
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12684
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12685
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12686
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12687
	newWidth = __intVal(w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12688
	newHeight = __intVal(h);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12689
	if (newWidth < 1) newWidth = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12690
	if (newHeight < 1) newHeight = 1;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12691
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12692
	XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12693
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12694
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12695
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12696
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12697
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12698
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12699
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12700
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12701
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12702
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12703
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12704
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12705
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12706
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12707
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12708
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12709
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12710
	if (__INST(ignoreBackingStore) != true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12711
	    if (how == @symbol(always)) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12712
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12713
	    else if (how == true) wa.backing_store = Always;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12714
	    else wa.backing_store = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12715
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12716
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12717
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12718
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12719
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12720
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12721
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12722
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12723
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12724
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12725
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12726
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12727
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12728
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12729
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12730
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12731
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12732
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12733
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12734
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12735
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12736
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12737
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12738
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12739
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12740
	    wa.bit_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12741
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12742
	    wa.bit_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12743
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12744
	    wa.bit_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12745
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12746
	    wa.bit_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12747
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12748
	    wa.bit_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12749
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12750
	    wa.bit_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12751
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12752
	    wa.bit_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12753
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12754
	    wa.bit_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12755
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12756
	    wa.bit_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12757
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12758
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12759
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12760
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12761
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12762
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12763
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12764
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12765
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12766
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12767
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12768
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12769
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12770
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12771
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12772
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12773
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12774
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12775
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12776
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12777
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12778
     && __isExternalAddress(aCursorId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12779
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12780
	Window w = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12781
	Cursor c = __CursorVal(aCursorId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12782
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12783
	if (w && c) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12784
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12785
	    XDefineCursor(dpy, w, c);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12786
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12787
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12788
	RETURN ( self );
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12789
    }
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12790
%}.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12791
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12792
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12793
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12794
setForegroundWindow:aWindowId
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12795
    "bring a window to front.
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12796
     Send a specific message to the WindowManager"
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12797
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12798
    |activeWindowAtom|
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12799
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12800
"/    self raiseWindow:aWindowId.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12801
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12802
    activeWindowAtom := self atomIDOf:#'_NET_ACTIVE_WINDOW' create:false.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12803
    activeWindowAtom notNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12804
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12805
	    sendClientEvent:activeWindowAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12806
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12807
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12808
	    propagate:false
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12809
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12810
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12811
	    data1:2                 "activate request from pager. This is a trick: kwm ignores requests from applications (1)"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12812
	    data2:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12813
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12814
	    data4:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12815
	    data5:nil.
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12816
    ].
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12817
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12818
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12819
      Transcript topView setForegroundWindow
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 12820
    "
5033
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12821
!
27bc058343f0 implement #setForegroundWindow: via WM controls
Stefan Vogel <sv@exept.de>
parents: 4928
diff changeset
 12822
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12823
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12824
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12825
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12826
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12827
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12828
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12829
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12830
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12831
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12832
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 12833
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12834
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12835
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12836
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12837
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12838
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12839
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12840
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12841
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12842
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12843
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12844
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12845
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12846
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12847
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12848
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12849
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12850
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12851
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12852
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12853
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12854
	XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12855
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12856
	XSetWMIconName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12857
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12858
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12859
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12860
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 12861
    self primitiveFailedOrClosedConnection
5071
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12862
!
4528b3bad057 care for twoByte window labels
Claus Gittinger <cg@exept.de>
parents: 5065
diff changeset
 12863
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12864
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12865
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12866
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12867
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12868
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12869
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12870
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12871
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12872
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12873
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12874
	if (__INST(hasSaveUnder) == true) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12875
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12876
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12877
	    XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12878
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12879
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12880
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12881
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12882
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12883
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12884
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12885
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12886
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12887
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12888
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12889
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12890
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12891
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12892
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12893
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12894
	Window w;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12895
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12896
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12897
	    w = (Window) 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12898
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12899
	    if (__isExternalAddress(aMainWindowId)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12900
		w = __WindowVal(aMainWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12901
	    } else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12902
		goto getOutOfHere;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12903
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12904
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12905
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12906
	XSetTransientForHint(myDpy, __WindowVal(aWindowId), w);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12907
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12908
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12909
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
 12910
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12911
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12912
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12913
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12914
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12915
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12916
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12917
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12918
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12919
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12920
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12921
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12922
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12923
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12924
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12925
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12926
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12927
	XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12928
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12929
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12930
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12931
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12932
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12933
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12934
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12935
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12936
    "set the windows background pattern to be a form.
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12937
     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
 12938
     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
 12939
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12940
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12941
    <context: #return>
4555
a03c1815901d new library naming scheme
Claus Gittinger <cg@exept.de>
parents: 4528
diff changeset
 12942
%{  /* STACK: 64000 */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12943
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12944
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12945
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12946
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12947
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12948
	XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12949
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12950
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12951
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12952
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12953
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12954
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12955
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12956
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12957
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12958
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12959
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12960
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12961
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12962
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12963
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12964
     && __isSmallInteger(aColorIndex)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12965
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12966
	XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12967
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12968
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12969
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12970
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12971
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12972
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12973
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12974
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12975
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12976
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12977
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12978
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12979
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12980
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 12981
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12982
     && __isExternalAddress(aPixmapId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12983
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12984
	XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12985
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 12986
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12987
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
 12988
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12989
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12990
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12991
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 12992
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12993
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12994
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12995
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 12996
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12997
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 12998
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 12999
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13000
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13001
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13002
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13003
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13004
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13005
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13006
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13007
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13008
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13009
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13010
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13011
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13012
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13013
			  0, 0, shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13014
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13015
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13016
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13017
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13018
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13019
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13020
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13021
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13022
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13023
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13024
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13025
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13026
%{
295
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)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13030
     && __isSmallInteger(aNumber)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13031
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13032
	XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13033
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13034
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13035
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13036
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13037
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13038
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13039
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13040
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
 13041
    "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
 13042
     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
 13043
     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
 13044
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13045
    <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
 13046
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13047
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13048
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13049
	XClassHint classhint;
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
	classhint.res_class = classhint.res_name = 0;
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
	if (__isStringLike(wClass)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13054
	    classhint.res_class = (char *) __stringVal(wClass);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13055
	} else if (wClass != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13056
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13057
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13058
	if (__isStringLike(wName)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13059
	    classhint.res_name = (char *) __stringVal(wName);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13060
	} else if (wName != nil)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13061
	    goto error;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13062
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13063
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13064
	XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13065
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13066
	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
 13067
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 13068
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 13069
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13070
    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
 13071
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
 13072
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13073
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13074
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13075
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13076
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13077
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13078
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13079
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13080
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13081
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13082
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13083
	if (how == @symbol(NorthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13084
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13085
	} else if (how == @symbol(NorthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13086
	    wa.win_gravity = NorthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13087
	} else if (how == @symbol(SouthWest)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13088
	    wa.win_gravity = SouthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13089
	} else if (how == @symbol(SouthEast)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13090
	    wa.win_gravity = SouthEastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13091
	} else if (how == @symbol(Center)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13092
	    wa.win_gravity = CenterGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13093
	} else if (how == @symbol(North)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13094
	    wa.win_gravity = NorthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13095
	} else if (how == @symbol(South)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13096
	    wa.win_gravity = SouthGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13097
	} else if (how == @symbol(West)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13098
	    wa.win_gravity = WestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13099
	} else if (how == @symbol(East)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13100
	    wa.win_gravity = EastGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13101
	} else {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13102
	    wa.win_gravity = NorthWestGravity;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13103
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13104
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13105
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13106
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13107
	XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13108
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13109
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13110
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13111
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13112
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13113
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13114
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13115
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13116
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13117
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13118
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13119
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13120
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13121
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13122
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13123
    aForm notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13124
	iconId := aForm drawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13125
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13126
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13127
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13128
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13129
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13130
	XWMHints hints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13131
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13132
	hints.icon_pixmap = __PixmapVal(iconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13133
	hints.flags = IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13134
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13135
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13136
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13137
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13138
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13139
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13140
    self primitiveFailedOrClosedConnection
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13141
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13142
    "Modified: / 26-04-2018 / 11:00:51 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13143
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13144
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13145
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13146
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13147
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13148
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13149
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13150
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13151
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13152
    aForm notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13153
	iconId := aForm drawableId.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13154
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13155
    aMaskForm notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13156
	maskId := aMaskForm drawableId.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13157
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13158
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13159
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13160
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13161
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13162
	XWMHints hints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13163
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13164
	hints.icon_pixmap = __PixmapVal(iconId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13165
	hints.flags = IconPixmapHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13166
	if ((maskId != nil)
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13167
	 && __isExternalAddress(maskId)) {
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13168
	    hints.icon_mask = __PixmapVal(maskId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13169
	    hints.flags |= IconMaskHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13170
	}
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13171
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13172
	XSetWMHints(myDpy, __WindowVal(aWindowId), &hints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13173
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13174
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13175
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13176
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13177
    self primitiveFailedOrClosedConnection
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13178
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13179
    "Modified: / 26-04-2018 / 11:01:04 / stefan"
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13180
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 13181
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13182
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13183
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13184
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13185
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13186
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13187
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13188
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13189
    aView notNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13190
	iconWindowId := aView drawableId.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13191
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13192
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13193
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13194
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13195
     && __isExternalAddress(aWindowId)) {
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13196
	XWMHints wmhints;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13197
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13198
	wmhints.icon_window = __WindowVal(iconWindowId);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13199
	wmhints.flags = IconWindowHint;
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13200
	ENTER_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13201
	XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints);
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13202
	LEAVE_XLIB();
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13203
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13204
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13205
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13206
    self primitiveFailedOrClosedConnection
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13207
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13208
    "Modified: / 26-04-2018 / 11:01:12 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13209
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13210
3245
b548dcf4993f cleanup
Claus Gittinger <cg@exept.de>
parents: 3238
diff changeset
 13211
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
 13212
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13213
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13214
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13215
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13216
%{
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13217
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13218
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13219
	Display *dpy = myDpy;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13220
	XSizeHints szhints;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13221
	Window win;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13222
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13223
	win = __WindowVal(aWindowId);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13224
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13225
	szhints.flags = 0;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13226
	if (__bothSmallInteger(minW, minH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13227
	    szhints.flags |= PMinSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13228
	    szhints.min_width = __intVal(minW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13229
	    szhints.min_height = __intVal(minH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13230
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13231
	if (__bothSmallInteger(maxW, maxH)) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13232
	    szhints.flags |= PMaxSize;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13233
	    szhints.max_width = __intVal(maxW);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13234
	    szhints.max_height = __intVal(maxH);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13235
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13236
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13237
	if (szhints.flags) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13238
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13239
	    XSetNormalHints(dpy, win, &szhints);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13240
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13241
	}
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13242
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13243
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13244
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13245
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13246
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13247
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13248
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13249
    <context: #return>
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13250
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13251
    |utf8StringAtom utf8String simpleString|
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13252
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13253
    utf8StringAtom := self atomIDOf:#UTF8_STRING create:true.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13254
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13255
    utf8String := aString utf8Encoded.
5967
d86c05b36723 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5938
diff changeset
 13256
    aString isWideString ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13257
	"/ X does not like 2-byte labels ...
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13258
	simpleString := aString asSingleByteStringReplaceInvalidWith:$?
4127
2be685c11752 to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents: 4119
diff changeset
 13259
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13260
	simpleString := aString.
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13261
    ].
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13262
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13263
%{
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13264
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13265
    XTextProperty titleProperty;
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13266
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13267
    if (ISCONNECTED
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13268
     && __isStringLike(utf8String)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13269
     && __isStringLike(simpleString)
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13270
     && __isExternalAddress(aWindowId)) {
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13271
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13272
	titleProperty.value =  __stringVal(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13273
	titleProperty.encoding = __smallIntegerVal(utf8StringAtom);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13274
	titleProperty.format = 8;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13275
	titleProperty.nitems = __stringSize(utf8String);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13276
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13277
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13278
	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(simpleString));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13279
	/* alternative settings for UTF8-Strings */
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13280
	XSetWMName(myDpy, __WindowVal(aWindowId), &titleProperty);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13281
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13282
	RETURN ( self );
5525
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13283
    }
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13284
%}.
9aae1d80c58e comment/format in: #initializeFor:
Stefan Vogel <sv@exept.de>
parents: 5510
diff changeset
 13285
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13286
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13287
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
 13288
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
 13289
    "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
 13290
     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
 13291
     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
 13292
     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
 13293
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13294
    | pid |
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13295
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
 13296
    pid := anIntegerOrNil isNil ifTrue:[OperatingSystem getProcessId] ifFalse:[anIntegerOrNil].
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13297
    self setProperty:#'_NET_WM_PID' type:#CARDINAL value:pid 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
 13298
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
 13299
    "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
 13300
    "Modified: / 26-04-2018 / 10:46:24 / stefan"
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
 13301
!
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
 13302
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13303
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13304
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13305
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 13306
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13307
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13308
    <context: #return>
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13309
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13310
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13311
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13312
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13313
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13314
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13315
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13316
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13317
    if (__isExternalAddress(aPixmapId))
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13318
	shapeBitmap = __PixmapVal(aPixmapId);
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13319
    else
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13320
	shapeBitmap = (Pixmap)0;
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13321
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 13322
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 13323
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13324
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13325
	XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13326
			  0, 0,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13327
			  shapeBitmap, ShapeSet);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13328
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13329
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13330
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13331
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13332
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13333
    self primitiveFailedOrClosedConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13334
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13335
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13336
setWindowState:aSymbol in:aWindowId
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13337
    "tell the window type to the window manager.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13338
     Send a specific message to the WindowManager"
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13339
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13340
    |netWmWindowStateAtom stateAtom|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13341
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13342
    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
 13343
    stateAtom := self atomIDOf:aSymbol create:false.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13344
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13345
    (netWmWindowStateAtom notNil and:[stateAtom notNil]) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13346
	self
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13347
	    sendClientEvent:netWmWindowStateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13348
	    format:32
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13349
	    to:(self rootWindowId)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13350
	    propagate:true
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13351
	    eventMask:((self eventMaskFor:#substructureNotify) bitOr:(self eventMaskFor:#substructureRedirect))
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13352
	    window:aWindowId
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13353
	    data1:(self atomIDOf:#'_NET_WM_STATE_ADD' create:false)
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13354
	    data2:stateAtom
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13355
	    data3:nil
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13356
	    data4:1
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13357
	    data5:nil.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13358
    ] ifFalse:[self halt.].
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13359
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13360
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13361
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13362
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13363
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13364
      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
 13365
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13366
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13367
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13368
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13369
setWindowType:aSymbol in:aWindowOrWindowId
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13370
    "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
 13371
     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
 13372
     chapter 'Application Window Properties'
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13373
     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
 13374
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13375
     It also helps to fix super-annoying problem with window autoraiser
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13376
     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
 13377
     window stacking, that's why it is called a 'window manager' :-)"
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13378
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13379
    | valueAtom |
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13380
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13381
    self assert:(#(_NET_WM_WINDOW_TYPE_DESKTOP
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13382
		  _NET_WM_WINDOW_TYPE_DOCK
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13383
		  _NET_WM_WINDOW_TYPE_TOOLBAR
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13384
		  _NET_WM_WINDOW_TYPE_MENU
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13385
		  _NET_WM_WINDOW_TYPE_UTILITY
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13386
		  _NET_WM_WINDOW_TYPE_SPLASH
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13387
		  _NET_WM_WINDOW_TYPE_DIALOG
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13388
		  _NET_WM_WINDOW_TYPE_NORMAL) includes: aSymbol).
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13389
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13390
    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
 13391
    valueAtom isNil ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13392
	"/Hmm, no such property, not running under EWMH compliant WM?
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13393
	self breakPoint: #jv.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13394
	^ self
8342
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13395
    ].
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13396
61d70299d474 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8341
diff changeset
 13397
    self setProperty:#'_NET_WM_WINDOW_TYPE' type:#ATOM value:valueAtom for:aWindowOrWindowId.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13398
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13399
    "
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13400
      |v|
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13401
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13402
      v := TopView new create.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13403
      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
 13404
      v open.
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13405
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13406
      |v|
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13407
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13408
      v := TopView new create.
5886
e72320525e18 comment/format in: #setWindowType:in:
Stefan Vogel <sv@exept.de>
parents: 5885
diff changeset
 13409
      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
 13410
      v open.
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13411
    "
5914
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13412
0b702d8f1439 changed: #setWindowType:in: to be EWMH compliant
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5908
diff changeset
 13413
    "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
 13414
    "Modified (format): / 26-04-2018 / 10:48:59 / stefan"
5862
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13415
!
8270a6c0c613 Virtual root handling for multiple screens
Stefan Vogel <sv@exept.de>
parents: 5850
diff changeset
 13416
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 13417
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13418
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13419
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13420
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13421
%{
4292
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13422
    /*
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13423
     * 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
 13424
     */
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13425
    if (! ISCONNECTED) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13426
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13427
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13428
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 13429
    if (__isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13430
	ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13431
	XUnmapWindow(myDpy, __WindowVal(aWindowId));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13432
	LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13433
	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
 13434
    }
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13435
%}.
153fc6f79fff Do not signal closedConnection in methods where a closed connection is ignored.
Stefan Vogel <sv@exept.de>
parents: 4286
diff changeset
 13436
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13437
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13438
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13439
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13440
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13441
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13442
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13443
    <context: #return>
4245
d28b613dfc06 timeout handling changed
Claus Gittinger <cg@exept.de>
parents: 4169
diff changeset
 13444
%{
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13445
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13446
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13447
     && __isExternalAddress(aWindowId)) {
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13448
	Atom JunkAtom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13449
	int JunkInt;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13450
	unsigned long WinState,JunkLong;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13451
	unsigned char *Property;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13452
	Atom WM_STATE_Atom;
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13453
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13454
	if (__INST(wmStateAtom) != nil) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13455
	    WM_STATE_Atom = __AtomVal(__INST(wmStateAtom));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13456
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13457
	    ENTER_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13458
	    XGetWindowProperty(myDpy, __WindowVal(aWindowId),
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13459
			       WM_STATE_Atom,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13460
			       0L, 2L, False, AnyPropertyType,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13461
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13462
			       &Property);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13463
	    LEAVE_XLIB();
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13464
	    WinState=(unsigned long)(*((long*)Property));
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13465
	    if (WinState==3) {
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13466
		RETURN (true);
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13467
	    }
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13468
	}
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13469
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13470
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 13471
%}.
3303
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13472
    self primitiveFailedOrClosedConnection.
8a2e99ebccb3 primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
 13473
    ^ false "/ or true or what ?
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13474
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13475
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13476
!XWorkstation::PseudoDeviceWithoutXFTSupport class methodsFor:'documentation'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13477
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13478
documentation
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13479
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13480
    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
 13481
    possibly overriding some messages.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13482
    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
 13483
    interface, which cannot draw strings into pixmaps using XFT fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13484
    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
 13485
    so it will draw using non-xft fonts.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13486
    This should vanish, once the xft drawing works.
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13487
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13488
    [author:]
7780
4221620dd940 comment
Claus Gittinger <cg@exept.de>
parents: 7756
diff changeset
 13489
	cg
7706
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13490
"
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13491
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13492
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13493
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'accessing'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13494
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13495
realDevice:aDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13496
    realDevice := aDevice.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13497
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13498
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13499
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'message forwarding'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13500
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13501
doesNotUnderstand:aMessage
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13502
    ^ aMessage sendTo:realDevice
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13503
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13504
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13505
!XWorkstation::PseudoDeviceWithoutXFTSupport methodsFor:'queries'!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13506
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13507
deviceFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13508
    ^ realDevice deviceFonts keys reject:[:f | f isXftFont ]
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13509
!
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13510
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13511
supportsXftFonts
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13512
    ^ false.
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13513
! !
58502053b67b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7699
diff changeset
 13514
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13515
!XWorkstation::SelectionFetcher class methodsFor:'documentation'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13516
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13517
documentation
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13518
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13519
    This class is responsible for fetching the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13520
    The X11 clipboard is implemented via asynchonous messages.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13521
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13522
    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
 13523
    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
 13524
    process that requests the clipboard.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13525
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13526
    [author:]
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13527
	Stefan Vogel (stefan@zwerg)
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13528
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13529
    [instance variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13530
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13531
    [class variables:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13532
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13533
    [see also:]
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13534
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13535
"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13536
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13537
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13538
!XWorkstation::SelectionFetcher class methodsFor:'selections'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13539
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13540
requestSelection:selectionId type:aTargetId onDevice:aDisplay for:aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13541
    ^ 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
 13542
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13543
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13544
!XWorkstation::SelectionFetcher methodsFor:'accessing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13545
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13546
drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13547
    ^ drawableID
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13548
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13549
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13550
getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13551
    "convert the data in buffer to a selection"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13552
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13553
    |selection|
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13554
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13555
    buffer isNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13556
	^ nil.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13557
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13558
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13559
    targetID == (display atomIDOf:#STRING) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13560
	display clipboardEncoding notNil ifTrue:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13561
	    selection := buffer decodeFrom:display clipboardEncoding
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13562
	].
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13563
	selection := buffer.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13564
    ] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13565
	"/ Transcript show:'UTF8: '; showCR:buffer storeString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13566
	[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13567
	    selection := buffer utf8Decoded.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13568
	] on:Error do:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13569
	    selection := buffer asString
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13570
	]
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13571
    ] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13572
	"/ Transcript show:'TEXT: '; showCR:buffer storeString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13573
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13574
    ] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13575
	"/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13576
	selection := buffer asString
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13577
    ]]]].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13578
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13579
    selection notNil ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13580
	(selection endsWith:Character cr) ifTrue:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13581
	    selection := selection asStringCollection copyWith:''
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13582
	].
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13583
	^ selection.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13584
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13585
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13586
    targetID == (display atomIDOf:#'TARGETS') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13587
	^ buffer
4268
f1726c185220 Selection fixes
Stefan Vogel <sv@exept.de>
parents: 4258
diff changeset
 13588
    ].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13589
    targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13590
	"require libboss to be loaded"
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13591
	(Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13592
	    'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13593
	    ^ nil
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13594
	].
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13595
	^ (Object
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13596
	    readBinaryFrom:(ReadStream on:buffer)
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13597
	    onError:[:ex |
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13598
		('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13599
		nil
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13600
	    ])
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13601
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13602
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13603
    '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
 13604
    ' buffer:' infoPrint. buffer infoPrintCR.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13605
    ^ nil
4559
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13606
95854882475c boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 4555
diff changeset
 13607
    "Modified: / 23-08-2006 / 15:56:04 / cg"
8189
44ec3d35edcd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
 13608
    "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
 13609
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13610
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13611
!XWorkstation::SelectionFetcher methodsFor:'event handling'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13612
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13613
message:aMessage
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13614
    "got an asynchronous event from the display.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13615
     Save and wake up waiters"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13616
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13617
    aMessage selector == #propertyChange:property:state:time: ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13618
	(aMessage arguments at:2) ~~ propertyID ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13619
	    "I am only interested in changes of the property used to
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13620
	     store the selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13621
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13622
	].
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13623
	message notNil ifTrue:[
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13624
	    "this should not happen - bad selection holder?"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13625
	    'XWorkstation(error): message overflow: ' errorPrint. display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13626
	    ^ self.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13627
	].
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13628
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13629
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13630
    "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
 13631
     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
 13632
     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
 13633
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13634
    message := aMessage.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13635
    sema signal.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13636
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13637
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13638
propertyChange:aView property:aPropertyId state:stateSymbol time:time
8266
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13639
    "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
 13640
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13641
    |property propertyValue|
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13642
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13643
    incremental ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13644
	"ignore property changes until we are in incremental mode"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13645
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13646
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13647
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13648
    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
 13649
    propertyValue := property value.
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13650
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13651
    propertyValue size == 0 ifTrue:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13652
	"property with size 0 signals end of transfer"
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13653
	done := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13654
    ] ifFalse:[
8348
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13655
	buffer isNil ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13656
	    targetID := property key.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13657
	    buffer := propertyValue.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13658
	] ifFalse:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13659
	    targetID ~= property key ifTrue:[
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13660
		'XWorkstation(warning): targetID change in incremental select: ' errorPrint. display errorPrintCR.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13661
	    ].
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13662
	    buffer := buffer, propertyValue.
38903c316df6 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 8347
diff changeset
 13663
	].
8266
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13664
    ].
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13665
55f8a8196020 #DOCUMENTATION by mawalch
mawalch
parents: 8261
diff changeset
 13666
    "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
 13667
!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13668
6157
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13669
selectionClear:aView selection:selectionId time:time
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13670
    "sent when another X-client has created a selection.
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13671
     This is a very X-specific mechanism."
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13672
!
244e739e05e9 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 6156
diff changeset
 13673
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13674
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
 13675
    "this is a forwarded selectionNotify event from XWorkstation"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13676
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13677
    |property propertyKey atomName|
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13678
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13679
    aSelectionID ~~ selectionID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13680
	"ignore notification that is not for our selection"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13681
	^ self.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13682
    ].
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13683
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13684
    aPropertyID == 0 ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13685
	"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
 13686
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13687
	^ self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13688
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13689
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13690
    property := display getProperty:aPropertyID from:drawableID delete:true.
5936
32467c3ce97d Fixed copy/paste problem
Stefan Vogel <sv@exept.de>
parents: 5934
diff changeset
 13691
    property isNil ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13692
	"the property does not exist in the specified window"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13693
	done := true.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13694
	^ self
5998
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13695
    ].
04c91c9d90f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5993
diff changeset
 13696
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13697
    propertyKey := property key.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13698
    propertyKey == aTargetID ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13699
	"good, the property is consistent with our request.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13700
	 The whole selection is in the property"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13701
	buffer := property value.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13702
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13703
    ] ifFalse:[propertyKey == (display atomIDOf:#INCR) ifTrue:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13704
	"this is an incremental transfer. Wait for property change"
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13705
	incremental := true.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13706
    ] ifFalse:[
6517
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13707
	atomName := (display atomName:propertyKey) ? propertyKey.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13708
	'XWorkstation(error): unexpected targetID (' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13709
	atomName errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13710
	') in selectionNotify: ' errorPrint.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13711
	display errorPrintCR.
3aae5fa95a99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6363
diff changeset
 13712
	done := true.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13713
    ]].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13714
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13715
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13716
!XWorkstation::SelectionFetcher methodsFor:'selection actions'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13717
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13718
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
 13719
    "request the selection of type targetId.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13720
     Wait for next asynchronous message and process it,
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13721
     until done"
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13722
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13723
    display := aDisplay.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13724
    drawableID := aDrawableId.
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13725
    selectionID := aSelectionId.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13726
    propertyID := display atomIDOf:#'VT_SELECTION'.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13727
    targetID := aTargetId.
8070
26577d2836ff #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 8062
diff changeset
 13728
    sema := Semaphore name:'X11SelectionFetcher'.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13729
    done := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13730
    incremental := false.
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13731
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13732
    [
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13733
	|timeout|
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13734
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13735
	display registerSelectionFetcher:self.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13736
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13737
	display
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13738
	    requestSelection:aSelectionId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13739
	    type:aTargetId
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13740
	    for:drawableID
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13741
	    intoProperty:propertyID.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13742
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13743
	timeout := display xlibTimeout.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13744
	[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13745
	    |currentMessage|
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13746
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13747
	    (sema waitWithTimeout:timeout) isNil ifTrue:[
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13748
		"the selection owner didn't respond within reasonable time"
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13749
		'XWorkstation(error): selection owner does not respond:' infoPrint. display infoPrintCR.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13750
		^ nil.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13751
	    ].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13752
	    currentMessage := message.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13753
	    message := nil.
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13754
	    currentMessage notNil ifTrue:[currentMessage sendTo:self].
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13755
	] doUntil:[done].
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13756
    ] ensure:[
8156
13f21ca2c852 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8070
diff changeset
 13757
	display unregisterSelectionFetcher:self.
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13758
    ].
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13759
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13760
    ^ self getSelection
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13761
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13762
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13763
!XWorkstation::SelectionFetcher methodsFor:'testing'!
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13764
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13765
matchesDrawableId:aDrawableId
4258
a4b5ac616c69 Fix a race condition when getching a selection.
Stefan Vogel <sv@exept.de>
parents: 4252
diff changeset
 13766
    "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
 13767
4252
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13768
    ^ drawableID = aDrawableId
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13769
! !
9dca820cd786 Fix selection handling (utf8 / incremental transmission)
Stefan Vogel <sv@exept.de>
parents: 4245
diff changeset
 13770
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13771
!XWorkstation::WindowGroupWindow class methodsFor:'documentation'!
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13772
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13773
documentation
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13774
"
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13775
    A special window to serve as window group id.
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13776
    This window is never mapped.
8350
470b52f7ae31 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
 13777
    This window is used in XWMHints & _NET_WM_LEADER properties
470b52f7ae31 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
 13778
    to define the application window group
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13779
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13780
    [author:]
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13781
	Jan Vrany <jan.vrany@fit.cvut.cz>
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13782
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13783
    [instance variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13784
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13785
    [class variables:]
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13786
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13787
    [see also:]
8358
1e93e10ae298 X11GraphicsContext moved
Claus Gittinger <cg@exept.de>
parents: 8355
diff changeset
 13788
	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
 13789
5984
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13790
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13791
"
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13792
! !
7380209f1108 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5983
diff changeset
 13793
6291
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13794
!XWorkstation::WindowGroupWindow methodsFor:'testing'!
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13795
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13796
isICCCWindowGroupWindow
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13797
    ^ true
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13798
! !
65b57dca9902 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6265
diff changeset
 13799
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 13800
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13801
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 13802
version
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 13803
    ^ '$Header$'
5938
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 13804
!
f5d6189257d4 comment/format in: #supportedTargetAtoms
Stefan Vogel <sv@exept.de>
parents: 5936
diff changeset
 13805
5473
d5687a021b55 __isByteArray() to __isByteArrayLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 5467
diff changeset
 13806
version_CVS
6904
eff65cefac62 class: XWorkstation
Claus Gittinger <cg@exept.de>
parents: 6873
diff changeset
 13807
    ^ '$Header$'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13808
! !
3758
c484f793f9b1 selection change handling
Claus Gittinger <cg@exept.de>
parents: 3738
diff changeset
 13809
5979
c50771acccc6 class: XWorkstation
Stefan Vogel <sv@exept.de>
parents: 5974
diff changeset
 13810
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 13811
XWorkstation initialize!